MtApi.getCategoryList (blogid, username, password)
mt.getCategoryList returns a list of all categories defined in the site

  • Parameter blogid:
    String
  • Parameter username:
    String
  • Parameter password:
    String
  • Returns
    Array of Objects representing Categories with the following properties .categoryId String .categoryName String, equals .categoryId
Sourcecode in MtApi/moveabletypeAPI.js:
1:   function getCategoryList(blogid, username, password) {
2:      var usr = root.blogger.getUser(username, password);
3:      var blog = root.blogger.getBlog(blogid.toString());
4:      if (!blog)
5:         throw("Couldn't find the blog " + blogid);
6:      var level = blog.members.getMembershipLevel(usr);
7:      try {
8:         blog.checkView(usr, level);
9:      } catch (deny) {
10:        throw("You're not allowed to view the blog " + blogid);
11:     }
12:     var arr = blog.topics.list();
13:     var topics = new Array();
14:     for (var i=0; i<arr.length; i++) {
15:       var param = new Object();
16:       param.categoryId = arr[i].groupname;
17:       param.categoryName = arr[i].groupname;
18:       topics[topics.length] = param;
19:     }
20:     return topics;
21:  }