MetaWeblogApi.getCategories (blogid, username, password)
metaWeblog.getCategories returns a list of categories for a site

  • Parameter blogid:
    String
  • Parameter username:
    String
  • Parameter password:
    String
  • Returns
    Array of Objects representing Categories with the following properties .description String .htmlUrl String .rssUrl String
Sourcecode in MetaWeblogApi/metaWeblogAPI.js:
1:   function getCategories(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:        trow("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.description = arr[i].groupname;
17:       param.htmlUrl = arr[i].href();
18:       param.rssUrl = null;
19:       topics[topics.length] = param;
20:     }
21:     return topics;
22:  }