WordPress XML-RPC — MovableType API

Those of you paying close attention probably noticed that I neglected to list a couple of the MetaWeblog API calls last week.  That’s because they’re duplicated by calls in the “wp” namespace, and I want to keep everything you can call with a “native” WordPress method in one group.  Luckily, none of the MovableType API calls are duplicated, so I can do them all in one pass.

mt.getCategoryList

Function: Retrieve a list of all categories on the blog.

Parameters:

  • Blog ID – For use in multisite installations, typically 0 for single sites
  • Username – WordPress username
  • Password – WordPress password

Returns: An array of categories with the fields “categoryID” and “categoryName.”

mt.getRecentPostTitles

Function: Retrieve the post titles of recent posts.

Parameters:

  • Blog ID – For use in multisite installations, typically 0 for single sites
  • Username – WordPress username
  • Password – WordPress password
  • Number of post titles to return

Returns: An array of recent posts:

  • ‘dateCreated’ – Post publication date
  • ‘userid’ – ID of the post author
  • ‘postid’ – ID of the post itself
  • ‘title’ – Post title
  • ‘date_created_gmt’ – Post publication date (as GMT time)

mt.getPostCategories

Function: Retrieve categories for a specific post.

Parameters:

  • Post ID – The post for which you want a list of categories
  • Username – WordPress username
  • Password – WordPress password

Returns: An array of categories attached to the post with the fields “categoryName,” “categoryID,” and the Boolean value “isPrimary.”

mt.setPostCategories

Function: Sets the categories for a post.

Parameters:

  • Post ID – The post for which you want to set the categories
  • Username – WordPress username
  • Password – WordPress password
  • Array of category IDs you want set on the post

Returns: True – nothing fancy, just an “OK, we’re done doing what you wanted us to do.”

mt.supportedMethods

Function: Retrieve an array of methods supported by this server.

Parameters: Nothing whatsoever.  Just call the method without any authentication and you’ll still get a response.

Returns: An array of the method names you can call on the server – including any custom method calls added by plug-ins.

mt.supportedTextFilters

Function: Not actually implemented … we don’t support per-post text filters in WordPress, but we kept the method call around because the MovableType API defines it.

Parameters: Don’t bother sending anything … the method does nothing.

Returns: All you’ll ever get back is an empty array … unless a plug-in has hooked onto the “xmlrpc_text_filters” filter for some strange reason.

mt.getTrackbackPings

Function: Retrieve trackbacks sent to a given post.

Parameters:

  • Post ID – The post for which you want to get a list of trackbacks

Returns: An array of trackbacks that have been sent to that post, including the fields “pingTitle,” “pingURL,” and “pingAuthor.”

mt.publishPost

Function: Sets a post’s publish status to ‘publish’.

Parameters:

  • Post ID – The post you want to publish
  • Username – WordPress username
  • Password – WordPress password

Returns: An integer value of 0 if publishing fails, otherwise it returns the ID of the new post.