Using REST with
Ajax
by Nic
Ferrier
02/23/2006
This article shows how to use Ajax techniques to make web apps
with REST APIs.
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,
for two reasons:
- Current HTML forms support only
GET and
POST, not PUT or DELETE
- HTML forms always involve a page change
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 web app. 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 web app leaves the REST API
uncomplicated and pure.
|