When I was working on the 1.2 release of Killer-Blog I ran into some mess. One of the main improvements is support for blogging API’s, so adding blog entries will be easier when using tools that support these. There are a couple of popular blogging API’s, most of which come from online weblog sites, such as MovableType and Blogger.
The reason for this post that I got kind of frustrated with the documentation on the API’s. They are not clear at all. So far, I implemented two API’s:
- Blogger API
Supported by Blogger.
The original spec can be found at the Blogger site. The spec is reasonably OK. The API itself is very limited in use. For example, you can add new post entries, but can only specify the body, and not the title.
- MetaWeblog API
Supported by a variety of blogging engine, such as RadioLand and MSN Spaces.
The original spec is on the XML-RPC site.
Now this last one is bot popular and bad. Here’s two examples:
- Check these fragments:
“The members of the struct passed in newPost and editPost come from the elements of items in RSS 2.0. The most commonly used core elements have no attributes, so it’s clear how to include them in the struct.”
They have got to be kidding! The RSS 2.0 spec lists all sub-elements of the <item> element. The publication date is called pubDate, whereas the MetaWeblog API expects dateCreated. That’s just one of the places where you are left guessing.
- Even the existing implementations such as the one for MSN Spaces tend to differ from the spec. Check the sample code at the MSDN site. It shows how the metaWeblog.getCategories implementation returns an struct consisting of a string for the description. But the spec mentions that when passing in categories, you should use an array of strings, and that the metaWeblog.getCategories should return an array of structs, consisting of strings for description, rssUrl and htmlUrl.
As a bonus, here is my definition of the server-side interface you need to implement for your engine to work. You’ll need to download the CookComputing.XmlRpc assembly from Charles Cook to implement the interface. There are some issues with the proxy generation in this library and .NET 2.0 RTM (and betas), but that shouldn’t affect you with this server-side implementation.
public interface IMetaWeblogApi
[XmlRpcMethod(“metaWeblog.newPost”, Description = “Makes a new post to a designated blog.”)]
[return: XmlRpcReturnValue(Description = @”Post ID of newly created blog post.”)]
string NewPost(string blogId, string username, string password, RssItem item, bool publish);