Stefan Tilkov's Random Stuff

GET Requests Updating the Database

Simon Harris:

The HTTP methods should be used to indicate the user’s intention without regard to the underlying implementation. The web application is an abstraction so we need to model the interaction on that abstraction. If the user’s intention is to make a change to something then go ahead and use a PUT but if they’re only reading some data use a GET even if you know it involves some database writes.

It may seem somewhat esoteric but spending a bit of time thinking about what the user’s intention is exactly has helped me better flesh out an application’s API.

I have the same experience: The CRUD analogy may help when you start “getting” REST, but you should leave it behind as soon as you can.

Comments

On April 15, 2008 11:46 AM, duryodhan said:

This is all pretty nicely explained in the HTTP RFC. Only after reading the RFC did it all become clear. For a standards document, it is suprisingly readable.