Atom Heart Blogger

I'll be releasing a new version (1.1) of ecto soon (if not today, then tomorrow). A new feature is preliminary support for Atom (see previous entry). Note the word “preliminary”, which I inserted for good reasons. One of these is that Blogger's implementation of Atom is still in beta. It still has a few bugs. For one, posting a new entry via Atom does not rebuild your blog. Also, since the old Blogger API did not support titles and the new Atom API does, any old entries will have part of the main contents as title. You'd have to rename the titles. The Blogger people are working on fixing these issues. In the meantime, if you use Blogger, you are free to try out the Atom support, but please keep in mind your blog won't be rebuilt automatically (and that's not my fault, mind you...).

To set up ecto (1.1 and higher) to use Atom with your Blogger account, launch ecto and start up the Account Manager. Press the “Add” button in the toolbar to create a new ecto account. Once you get to the account details, set the “Access Point:” field to “http://www.blogger.com/atom/” and the “System:” to “Atom”. Let the configuration process finish, and retrieve a list of recent entries from your Blogger account, if it doesn't already happen automatically. One other bug in the Blogger implementation of Atom is that it should return 20 entries, but will return fewer if your blog is configured to only show the last 7 days of entries.

ecto also works with TypePad's implementation of Atom, but I do not recommended it, since this API supports fewer features than the standard TypePad API. In the nearby future, however, ecto will be using additional routines in TypePad's Atom API to manage TypeLists and PhotoAlbums.

If you want to use ecto to test your own Atom implementation, then read on for a description of what ecto is expecting.

Authorization

ecto assumes you implemented the WSSE authorization protocol. You'll be receiving a request that includes the headers:

Authorization: WSSE profile=“UsernameToken”
X-WSSE: UsernameToken Username=“bob”, PasswordDigest=“quR/EWLAV4xLf9Zqyw4pDmfV9OY=”, Nonce=“d36e316282959a9ed4c89851497a717f”, Created=“2003-12-15T14:43:07Z”

PasswordDigest is created using the rule:

PasswordDigest = Base64((SHA1(Nonce CreationTimestamp Password)))

Nonce is just a random string and is Base64-encoded in the X-WSSE header, but not in the PasswordDigest string.

List of blogs

To get a list of blogs, ecto sends an HTTP GET request to the URL set in the “Access Point” field. On return it expects a list of 'link' tags. For example, Blogger returns:

<feed xmlns=“http://purl.org/atom/ns#”>
<link href=“http://www.blogger.com/atom/1” rel=“service.feed” title=“testing” type=“application/x.atom xml”/>
<link href=“http://www.blogger.com/atom/1” rel=“service.post” title=“testing” type=“application/x.atom xml”/>
</feed>

You can get away with only a “service.post” link, but it means that ecto will send it a HTTP GET to get a list of recent entries. Be that as it may, having a “service.feed” and a “service.post” is recommended.

Entries

ecto currently only uses the fields 'title', 'content', and 'issued'. The date format for the 'issued' field can be either, for example, “2004-03-09T05:55:16 09:00” (with timezone in hours difference) or “2004-03-08T20:58:18Z” (set to GMT). Both title and content should be in one of the three modes xml, escaped, or base64.

When posting entries, ecto will send them in the following example format in which 'issued' is an optional field. It should be set by the server if not present.

<?xml version=“1.0” encoding=“UTF-8” standalone=“yes”?>
<entry xmlns=“http://purl.org/atom/ns#”>
<generator url=“http://www.kung-foo.tv/ecto/”>ecto</generator>
<title type=“text/html” mode=“escaped”>title</title>
<issued>2004-04-14T23:21:14 0900</issued>
<content type=“text/html” mode=“escaped”><strong>test</strong></content>
</entry>

Note that because of MacOSX's bug with sending body-less HTTP PUT messages, entries are posted wrapped in a SOAP request and send as HTTP POST (details).

After posting an entry, ecto expects the published entry back as a response. It should contain the “service.edit” (which TypePad does not do at the moment) and an “alternate” link (aka the permalink).

I'm trying to have ecto be as flexible as possible, but please understand that it's not easy to have both XML-RPC and Atom play nice together in the same client.

Posted by Adriaan on April 28, 2004