| Author |
REST and uptake of http PUT/DELETE
|
Katie Portwin
Greenhorn
Joined: Mar 22, 2006
Posts: 5
|
|
Hi Leonard and Sam, I think I'm right in my understanding that proper use of the full set of HTTP Verbs is crucial to the REST model - Get for return resource, Delete for delete resource, Put for insert resource, Post for update resource? This all seems very sensible. However, what do you think about the continued low uptake of Put and Delete by most programmers, (and the real/imagined patchy support - eg CGI.pm..) ?
|
 |
Sam Ruby
author
Greenhorn
Joined: Jul 23, 2003
Posts: 13
|
|
First, it is not crucial. You can get by with less. What I have found important, however, is that if you start with a clean design and then optimize and/or make tradeoffs generally works better than if you prematurely optimize for limitations in various tools. The current Ruby on Rails support for REST follows this model: a clean design with alternative interfaces for those who can't do PUT or DELETE. PUT and DELETE support is wider than you might think. The one place where it is most notably lacking -- HTML Forms -- is also a place where not much WS-* interfaces work.
|
Sam Ruby
|
 |
Leonard Richardson
author
Ranch Hand
Joined: Jun 08, 2007
Posts: 37
|
|
Hi Katie, We recommend using four verbs, but you don't have to. You can use GET for safe operations, and POST for everything else. The catch is that the client should POST to the same URI it GETs. That forces you to think of your URIs as designating objects instead of operations. (To quote page 221, "REST says you should use a uniform interface, but it doesn't say which one.") So, lack of four-verb support is not a catastrophe, but the four do help people step back from how web applications are traditionally designed, and think of URIs as designating objects. The flip side of that is you're not going to start using PUT and DELETE unless you're willing to change how you think. I'm amazed at the speed with which Rails went from having side effects for GET to being totally based on RESTful resources. But heavily-used libraries change very slowly, and often it's easier to write a new library. This happened with Python HTTP clients: we have urllib, urllib2, and now Joe Gregorio's httplib2. I think it will also happen with web service frameworks. This was kind of rambling but I hope it answered your question. By the way, you kind of switched PUT and POST. PUT is for updating resources, and for creating brand new resources. POST is for spawning a new resource from an existing one. Leonard
|
 |
 |
|
|
subject: REST and uptake of http PUT/DELETE
|
|
|