Friday, February 24th, 2006

Using a REST Web Service with Ajax

Category: Ajax

In this article, Nic Ferrier explains how to use simple Ajax techniques to interface with a remote REST (Representational State Transfer) web service.

Everyone’s talking about REST these days. Lots of people are still struggling with it, and there’s good reason for that–REST is actually quite difficult to fit into the browser-based HTML Web. As far as I’m concerned, this is fair enough; REST is primarily a web services platform, an alternative to CORBA, SOAP, and XMLRPC, not a user interface. Still, at least some of the time, it’s nice to use a REST API as the foundation for a webapp. On the other hand, Ajax can be really complicated, and it always seems to involve lots of different bits of code.

That is the point of this article. REST’s clean definition of an application’s architecture solves at least some of the problems with Ajax; and using Ajax to a REST webapp leaves the REST API uncomplicated and pure.

They detail the implementation of a REST web service as written in Python, including in it the ability to manage a user’s feeds through various HTTP methods (GET, POST, and DELETE) and calls. There is a block of code for each that performs the operation based on the input parameters (or lack thereof).

Last, but not least, they show the simple Ajax implementation – creating the XMLHttpRequest object “by hand” – that can make the requests to the web service. It’s then possible to visually manage the feeds via the list contained in the form with checkboxes to the side of each.

Posted by Chris Cornutt at 8:32 am

4 rating from 22 votes


Comments feed TrackBack URI

Check out the “patent” on AJAX. I hope this doesn’t last long.

Comment by Marlo — February 27, 2006

Check out the “patent” on ajax. I hope this doesn’t last.

Comment by Marlo — February 27, 2006


Comment by fsdf — March 9, 2006

Leave a comment

You must be logged in to post a comment.