Versatile RESTful APIs Beyond XML

An article I wrote has just been published over at InfoQ. It’s called Versatile RESTful APIs Beyond XML and shows how easy it can be to extend Rails’ RESTful behaviour to input and output resources not only as XML but also as JSON and Microformatted HTML. The article builds on some posts on this blog, such as Intercepting Microformats In Rails Input, but offers a bit more context. The timing of the article fits nicely with a post on the microformats-rest list about Rails, REST and microformats, so hopefully we’ll see more discussion of these concepts over the coming weeks. ...

March 14, 2007

Relax over REST

Mark Nottingham has a good post running through a few topics on which people get needlessly caught when designing RESTful applications. If you’re new to working on RESTful application design (as many rails developers are) it’s worth checking out to save yourself needless anguish. Thankfully for Rails developers at least some of the issues he identifies will be a little simpler than they might be for people designing systems from scratch. In particular, while there are a few URL design choices (numeric IDs, other parameters, or a hybrid? nested vs. flat?) the conventions are good and changing isn’t all that hard. ...

February 27, 2007

Namespaces, attributes and content in rxml

Rails’ RXML templates (powered by Builder) are a great way to generate various different types of XML output from your application, but the documentation could be lacking. I’ve been working with namespaced content for a while but I’ve spent quite a while today trying to work out how to add an element in an explicit namespace, with attributes and text content. To create an ‘id’ element is straightforward: xml.id 'my-id-here' and then to put that tag in the ‘foo’ namespace you need: ...

August 22, 2006

Feeds in the Blogger Beta Updates

After TechCrunch posted about the new version of blogger (currently in beta) I decided to give it a look, particularly to see what was going on with their feed support as TechCrunch claim that blogger would be switching to RSS2 for its feeds (revisiting TechCrunch it seems they’re now saying RSS2 will be offered in addition to atom so I don’t know if I misread that or it’s been updated. Personally I don’t see the point of adding RSS2 when you have Atom, and wonder if it might be confusing for some users, but I guess someone must disagree). ...

August 15, 2006

XML_Feed_Parser: Now in PEAR

On Monday morning I received noticed that XML_Feed_Parser had been accepted into PEAR. The voting process brought a few useful comments, and the latest version cleans up a few of those issues, including adding a custom Exception class. You can now find the package’s homepage on the PEAR site and it is also stored in the PEAR CVS repository for those who want to get the latest development version or check the source before downloading. PEAR users can get the latest version with: ...

October 11, 2005

Tinkering with Atom

For a while now I’ve been talking about writing some classes to ease use of Atom in PHP, primarily as a base for an implementation of the Atom Publishing/Editing Protocol. I’ve been putting it off, partly due to time restrictions, and partly because the Atom Syndication Format isn’t quite an approved standard yet and I didn’t want to have to spend too much time keeping up with drafts. Atom is rapidly approaching stability, and a little time over the weekend has led me to start work on some code. Rather than just write a parser for Atom I decided to follow the lead set by Mark Pilgrim’s Universal Feed Parser, which makes working with feeds in python a breeze, and have begun to shape some classes that I hope will provide a similar level of flexibility and abstraction for PHP coders. ...

June 5, 2005