What the current SOAP fad has done is to make us forget how to build and deploy applications on the Web according to the true HTTP specification. Even wikipedia is incredibly confused and confusing with respect to HTTP. It is ridiculously simple, but overly ignored and misrepresented.

GET Get some resource identified by a URI. This request should not change the state of the resource.
The resource itself may change over time however.
POST

Add a new resource (post a new message, a new comment, a new post, a new file) or modify an existing resource. The provided URI is not the URI of the new resource, but rather the URI of a related resource (for example, the URI of the blog or posting board).

PUT

Create or replace a resource having the given URI. This method is idempotent!

DELETE Delete a resource.

What does this mean?

  • A POST from should never replace a resource. A POST form cannot be used to edit a post and is safe.
  • GET queries are stateless. No matter who does the GET, the same result should come out. If I copy and paste a URL in my browser and pass it to someone else, they should end up with the same resource. A GET query cannot create, change or delete a resource. GETs are safe. I should always be able to follow a link without fear of deleting or buying something.

As to why this might not work, see what Parand had to say about it.

2 Comments »

  1. In practice PUT and DELETE are rarely used and POST is rarely safe. Part of the problem is the lack of support for PUT and DELETE; I tried using them in a project last year but ended up giving up and going with POST because some toolkits and browsers just don’t support it.

    Comment by Parand — 16/2/2007 @ 17:24

  2. I know this, and you are not contradicting me, I wrote “It is ridiculously simple, but overly ignored and misrepresented.”

    Comment by Daniel Lemire — 16/2/2007 @ 18:46

Leave a comment

Warning: When entering a long comment, please ensure that you make copy of your text prior to submitting it. If the server should fail or if you hit a bug, you might lose your work. I am not responsible for your lost effort.

To spammers: I carefully review every single post and make sure that spam gets deleted. You are wasting your time if you are manually entering spam using this form. Read my terms of use to see what I consider to be abusive.

Example: duo plus septem is '9'. The numbers are expressed in latin numerals but you should give your answers using ordinary digits.

 

« Blog's main page

Powered by WordPress