REST is not CRUD
April 19, 2007
Interesting post by Keyur Shah:
A common way of designing a REST system is to recognize the resources and associate a logical hierarchy of URLs to them and perform the traditional CRUD operations by using the well-known HTTP methods (GET, POST, PUT and DELETE).
Check out the discussion in the comments; I believe this is a very common misconception — if REST is CRUD (Create, Read, Update, Delete) and I need more semantics than that, the right way surely must be to introduce new methods?
No, it’s not. This is probably the hardest thing to grasp about REST — the fact that any and all application semantics can be mapped to the uniform REST interface (the HTTP verbs) without introducing actions (operations/methods) into the URL, and without adding new verbs. I feel oddly compelled to write about this … but only after my (second) talk at JAX 2007, which is about this exact topic.
About
This page contains a single entry from Stefan Tilkov's Random Stuff posted on April 19, 2007 9:03 PM. The previous post in this blog was Build Tools. The next post in this blog is Version Numbers. Many more can be found on the main index page or by looking through the archives.
Comments
I think you mean the HTTP verbs, right?
Posted by: jsled at April 19, 2007 10:29 PM | link
Thanks, fixed.
Posted by: Stefan Tilkov at April 20, 2007 7:27 AM | link
Looking forward to reading your write-up on the matter!
Posted by: Asbjørn Ulsberg at April 20, 2007 9:45 AM | link
It’s true that any application semantic can be mapped to those existing methods, but in some cases there can be a considerable cost in efficiency by using them and a new method is warranted. Consider the example of COPY; doing it as a GET followed by a PUT means that the client requesting the interaction has to download the initial representation; if it’s large, then COPY is far more efficient.
Posted by: Mark Baker at April 22, 2007 1:40 PM | link
I agree, but still maintain that this is the exception (and my guess is you agree).
Posted by: Stefan Tilkov at April 22, 2007 5:14 PM | link
