REST is not CRUD
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.
I think you mean the HTTP verbs, right?
Thanks, fixed.
Looking forward to reading your write-up on the matter!
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.
I agree, but still maintain that this is the exception (and my guess is you agree).