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

RESTful Rails Development PDF

I’d been meaning to take a look at Ralf Wirdemann, Thomas Baustert, Florian Görsdorf and Adam Grove’s Restful Rails Development PDF for a few days, and time travelling over the weekend gave me that opportunity. I didn’t go through it all in great detail, as it’s fairly introductory material, but if you’re wondering how to get started with RESTful rails it provides a great overview to get you going. You can find it here. ...

March 1, 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

Intercepting microformats in rails input

In Input formats and content types in Rails 1.2 I mentioned a project I’ve been working on that will provide a RESTful service interface which accepts its input in a number of formats, including microformatted HTML. For certain types of data microformats provide a great way to receive input as they don’t require your clients to learn a new schema to send you data. They can take the same semantically rich HTML they’re displaying on their website and POST it to your endpoint. Or they can use a tool like Ryan King’s hcalendar creator to generate some sample input. ...

February 20, 2007

Input formats and content types in Rails 1.2

One feature of recent releases of Rails I hadn’t spotted before is the ability to define your own parameter parsing based on content type. I’m working on an application that will employ a RESTful API and that I hope will take its input in either standard http parameters, microformatted HTML, XML or JSON. I don’t really want to have to write custom code within the controllers to interpret the input based on content type, so I started looking for how rails parses XML input and came across the following in the actionpack changelog: ...

February 3, 2007

Corrected bus routes on Rails

In the process of building my bus route app, I realised that half the data for bus stops is missing. While the site’s developers have done a good job of providing clear data on half the stops, if you want to see stops going in the other direction, you have to use a drop-down box that triggers an AJAX request and repopulates the table. A little digging shows that the call is to: ...

September 26, 2006

Bus routes on Rails

Following on from my previous entry about scraping bus route data from The Rapid’s website, and to begin to demonstrate the possibilities it opens up, I’ve set up a simple web service to provide route and stop data. It’s based on the new REST style from Edge Rails, and routes are scoped by city to allow for future expansion. To get data on Route 1, GET: http://projects.jystewart.net/buses/cities/1/routes/1 To get a list of the stops within 1.5 miles of a given longitude and latitude, GET: ...

September 25, 2006

Services_Technorati Proposal

After a few days’ distraction I’ve now submitted a draft proposal for Services_Technorati. The attention.xml support still isn’t working as it should, but other than that it seems to hold together. Getting it up there hopefully means a little help with testing, and perhaps a bit more impetus to keep working on it. You can find the PHP source and a quick example here.

February 15, 2005