Monday, July 04, 2011

PUT vs. POST Creation Paradigm

To create a new “thing” shall I use PUT or POST?

There is a clear answer for this question:

- If the client is responsible for creating the ID of the “thing” use a PUT
E.g: “./users/roni” <- roni is unique and given by the client -this is a new URI!

- If the server is responsible for creating the ID of the “thing” use a POST
E.g. “./users/” and as a post key/value the client transfers username=roni and prob. to id would be an auto generated number.


No comments:

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge