I had an interesting conversation with Paul Downey the other day. REST is cool, its cool because its straight forward, pretty easy to understand (if you understand how a browser works, you understand REST), and its intuitive. However, no one can really claim to have implemented a REST web-service (and why would they, it’s a noose for the RESTians to hang you with).
Amazon and Yahoo all have apparent “REST” apis, that both break the first rule of REST, don’t use a GET if its not ‘safe’ i.e. don’t use a getter(http GET) to perform the actions of a setter(http POST). This is perhaps more obviously ‘wrong’ in the world of REST, but many of the rules are unwritten. Should I post to www.example.com/dostuff or www.example.com/dostuff/ or both? What should I do if someone sends me data in a format I didn’t expect e.g. Content-Type=text/html, when I expect text/xml?
Maybe this is trivial, but the point is that without guidelines or rules then how can REST services be consistent? Well, they can’t, perhaps that’s their advantage, perhaps not, depends if you’re an enterprise or a basement developer I suppose, and I suppose that’s why we have SOAP. Joy.
Great article how to provide a web api, talks about keeping things simple, which I think is the key to success. Again here Alex talks about not using HTTP for an unsafe operation. Its clearly wrong when you look at the http spec, but why services do it is really easy to answer. Because users can do cool stuff just by typing text in their address bar, they can delete photos on Flickr, send a text from Gizmo. Do they care that it’s not RESTful, I doubt it, not if they’re making money.