Stefan Tilkov's Random Stuff

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.

Comments

On April 19, 2007 10:29 PM, jsled said:

I think you mean the HTTP verbs, right?

On April 20, 2007 7:27 AM, Stefan Tilkov said:

Thanks, fixed.

On April 20, 2007 9:45 AM, Asbjørn Ulsberg said:

Looking forward to reading your write-up on the matter!

On April 22, 2007 1:40 PM, Mark Baker said:

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.

On April 22, 2007 5:14 PM, Stefan Tilkov said:

I agree, but still maintain that this is the exception (and my guess is you agree).