Blogging APIs

On the blosxom mailing list, someone was confused about the interaction between the different APIs for accessing blogging tools and formats. They asked what the story was, and I responsed with this summary of the market (available from the blosxom mailing list archives) (which was current at the time, but getting a little dated now);

From: “Beau” <beau@d…>
Date: Tue Mar 9, 2004 4:00 pm
Subject: Re: [blosxom] APIs, new blogging things, etc.

Ok Steve, I’ll take a bash at some of this, since I’ve been working with blogging APIs for a couple years now in effect, I’ve come across all the ones that you’ve mentioned 🙂 Someone else please fill gaps or correct me if I slip up somewhere 🙂

Ok – so, in approximate chronological order of time of appearance on the scene;

* Blogger API 1.0
http://plant.blogger.com/api/
The original – based on XML-RPC [1] calls, gave access to most (all?) of Blogger’s original functionality, and was pretty darned easy to use. You POST an XML doc with encoded requests in it to a specific URL, and the response is another XML doc which you can then use however you like. Ev Williams of Blogger knocked this up over a couple of days apparently, and it went crazy from there – I’m still using it today in http://www.beaulebens.com/avantblog and it still works (usually :P)

* metaWebLogAPI
http://www.xmlrpc.com/metaWeblogApi [Added 2004-07-07]
Effectively a derivative of the Blogger API (and also XML-RPC based), this one came up to support Radio, I believe Dave Weiner knocked it up, and there was some animosity between he and Ev Williams over whether they should combine to create a unified blogging API (Radio and Blogger being the big 1 at the time) or go their separate ways. I believe one of the main reasons things went this way was because Blogger didn’t need/want title field support, but Radio did,
thus the metaWebLogAPI, intended to be more universal.

* Blogger API 2.0
http://www.blogger.com/developers/api/documentation20.html
Blogger realised that with their new versions, support from Google etc, they needed to clean up their API-act, so they started working on API 2.0. This one supports title fields and a number of other things, and is accessed via XML-RPC as well. As you can see at the URL, the draft specs were released in Feb 2003, but a couple months later, it was revoked and people were instructed not to use it, because there was no support for it and Atom (then called Echo) was going to be used in prefence… which brings us to…

* Echo… Necho… Atom API
http://www.intertwingly.net/wiki/pie/FrontPage
http://www.atomenabled.org/
Originally called Echo, then they decided that was no good, so it was refered to as Necho (Not Echo) for a while, and finally ended up being called Atom. This one is based on a REST architecture ([2], [3]), based on [4]. The Atom API sort of duplicates the efforts of RSS, in that it presents blog data in an XML format, but it also allows you to modify that data (thus API) via
REST-style interactions, involving PUT/POST/DELETE requests. I haven’t worked all this out just yet, but I have to so that I can update a few projects of mine (namely AvantBlog [5] and webpad [6]). There is also a SOAP [7] implementation of Atom, which I assume supports all the same sort of functions (retrieving posts/blogs, updating them etc), tho I haven’t looked at that at
all, as personally I hate SOAP 🙂 The idea of Atom is to provide a universal API which will be supported by all blogging systems (I believe MT and Blogger are already on board, others are likely to follow) so that we can write tools which will interop with all systems easily.

[1] http://www.xmlrpc.com/
[2] http://internet.conveyor.com/RESTwiki/moin.cgi/FrontPage
[3] http://www.xfront.com/REST.html
[4] http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
[5] http://www.beaulebens.com/avantblog
[6] http://www.beaulebens.com/webpad
[7] http://www.w3.org/TR/soap/

Now, as for blosxom’s support for any of this mumbo jumbo – I know that sxtem [8] was written to provide Blogger API functionality for blosxom, and then you also have the atomfeed plugin [9] to provide an outgoing only (RSS-like syndication side of Atom, but not the modification side) feed for blosxom blogs. As for complete Atom API integration (allowing post editing etc via REST-calls), I’m not aware of any implementation allowing that so far, probably because the Atom spec [10] is still somewhat in flux, and even if it’s not, it’s a little hard to understand (for me at least :).

[8] http://www.blosxom.com/plugins/input/sxtem.htm
[9] http://www.blosxom.com/plugins/syndication/atomfeed.htm
[10] http://www.atomenabled.org/developers/api/atom-api-spec.php

So there you have it – as far as I am aware, that’s how the playing field lies at this point in regards to blogging APIs, and I haven’t even bothered to mention Movabletype (which, incidentally, implements a mish-mash of Blogger.com API and metaWebLogAPI functionality), so we’re doing quite well 🙂 The beauty of blosxom is that to some extent, it doesn’t even need any of this mumbo-jumbo – you can call FTP the blosxom API if you really want 🙂 When I eventually get an Atom toolkit operational, it’ll be written in PHP and linked from my Blogger API page [11], which is the current home of a number of other PHP-based blogging classes and function libraries. Until then – I’ll keep an eye out and play Lazy-web-style in the hope that someone else will beat me to it 🙂

[11] https://beaulebens.com/bloggerapi/

Cheers, and I hope that sums things up for you Steve (and others)

Beau


Beau Lebens
Information Architect
beau@d…
Dented Reality – www.beaulebens.com
Information Architecture, Usability, Web Development

Problem With Permissions

As I have previously experienced, creating files on the server using webpad can sometimes cause problems with permissions, because the resultant files are owned (on a *NIX box) by the user that Apache was running as. Since that’s not normally the same as your shell user, you can have some problems managing those files later on.

Ideally, I’d have webpad create files, then change them so that a specified user account owns/controls them, but that the Apache user would have access to them. Since I’m yet to get this working (or figure out exactly how I can do it on DreamHost), in the meantime I am just creating files or directories and immediately chmod’ing them to 777 (I know, I know, not secure etc, but the only way I can do it so that I can work with the files later.)

Anyone know a better way of doing it?

I am also considering switching away from HTTP Authentication, and using a form to log in to webpad, which might just allow me to run webpad in CGI mode on DreamHost, and thus solve user problems, because it would run as my user… will keep you posted on that though.

Personal Information Portal

As ‘buzzword’ as that sounds, that’s basically what I’m building for myself. It’s got an integrated bookmark manager, basic email features, news aggregation, calendar, file management, plus to-do list and sticky notes (via web-form or email thanks to the power of blosxom!).

It’s framed like crazy, but will include some cool DHTML tools and things to make it easier to use and more friendly. I’m basing as much as possible on XML/XSL as well, so that is proving to be interesting. I already have a basic version of the sticky notes and to-do list features working (ugly, but operational) and that’s using XML and XSL exclusively (coming from a blosxom backend!)

I hope to build it so that it’s easy to add new tools/features into it, and that it can provide a useful point for me to start whenever I get online, since it’ll be accessible from anywhere, and have access to most things I need!.

Blank File Bug Fixed

I’ve finally figured out a bug in the current development version of webpad that meant once in a while I’d somehow overwrite a file I had previously been working on with a blank file.

Turns out that it was because I was reloading webpad in a window which I had previously used it, so the session (containing filenames etc) was still active. When webpad loaded, it was triggering the ‘save’ operation, and saving the now-empty main window as the file I was previously working on. All I’ve done is make it so that you can’t write a blank file now — if you want to delete something, you should be using the delete operation in the file dialog anyway.

One step closer to release! Blogs are still a sticking point tho… how/what to support on Blogger.com/MovableType is the thing holding me up. Complete blosxom support is already in there, and works wonderfully – I’m using it to maintain my blogs and website. The Blogger Atom API sounds really ugly and excessively complex, but I’ll let it stabilise a little more and then have a proper look at it I think…

API Problem Fixed

Thanks to a suggestion from Bill, I found the problem that AvantBlog has been having when attempting to authenticate with the Blogger.com servers… basically they moved their servers!.

As Robert discovered in this post, the server that responds to API requests moved from plant.blogger.com to www.blogger.com, so basically I was posting authentication requests to a server that didn’t exist. This has been rectified now and it appears to be operating properly.

Enjoy your blogging folks 🙂

Problems with Blogger.com

Something appears to be wrong with Blogger‘s API server, so AvantBlog authentication is very touch-and-go. I’ve modified the program slightly so that it reports properly when it can’t connect to their server, so at least you’ll know what’s going on. Also, on suggestion from Ron, I’ve added a ‘Try Again’ link so that you can log out/log back in again and see if their servers are responding properly.

This problem appears to have been happening for the last couple days at least, so let’s just hope that Blogger sort it out soon. I wonder if their fancy new Atom API is going to be any more reliable?

File Append Function

Here’s a useful function that I wrote for PHP – it just opens a specified file and appends a string to it. It’s very good for logging things.

<?php
/**
 * @return boolean
 * @param $file FileNameToWriteTo
 * @param $string StringToWriteToFile
 * @desc Writes specified string to the end of the file with a linefeed attached
 */
function file_append($file, $string) {
	if (is_file($file) && is_writable($file)) {
		$fh = fopen($file, 'a');
		if ($fh) {
			fwrite($fh, $string . "\n");
			fclose($fh);
			return true;
		} else {
			return false;
		}
	} else {
		return false;
	}
}
?>

You might want to consider making the fopen() flags ‘ab’ for binary-safe (now reccommended on php.net) and also changing the ‘\n’ part to the appropriate line-endings for your operating system (\n = *NIX, \r\n = Windows, \r = Mac).

BlogLines Is Cool

Have I mentioned BlogLines.com? It really is a cool service, and what’s more – it’s free.

BlogLines is an RSS aggregator; don’t let that big name scare you – basically it allows you to get content from a bunch of sites, organised into your own directories and catgories, all in one place. It’s perfect for keeping up to date on news, reading your daily blogs, or perhaps receiving certain types of updates and things like that.

There’s not much I can say, other than it’s a very well-made system, it’s entirely web-based (so you can access it from all machines you use) and it has some great features which make managing your feed subscriptions really easy. Check it out and see what I’m talking about.

If Not For The Blogs

webpad development is coming along very well, and the UI is streets ahead of version 2.0, with a collection of really useful little extras, some great new features and some bits and pieces that just make life a lot easier while using the program. If it weren’t for the blogging functionality, I’d be this close to releasing a beta version of 3.0 Personal Edition.

Incidentally, adding the functionality for the fantastic blogging application, blosxom was completely trivial, care of it’s wonderful use of the file system of the server that it’s hosted on. In effect, blosxom blogs within webpad are represented as alternate home directories, and use all the same file access operations as the normal server actions do – excellent!

Check it out and get yourself a copy of blosxom if you’re running a blog, it’s the best thing out there if you don’t mind a bit of hackery and custom mods 🙂

File Upload Working

Well, after having some terrible problems with the file upload tool on the new version of webpad, I finally have it working.

Turns out the main problem was that my cleanup script that removes temp files periodically from webpad’s directory was cleaning up the uploaded files before you had a chance to move them to their permanent location. Now that that’s under control, all’s well!