Wednesday 18 December 2013

RESTful design

Get Operations should be idempotent - performing the operation should not alter the underlying resource in any fashion. It can be performed n times and it always returns the same result.

POST should be used to create resources.

PUT should be replace the entire copy of the resource. If it exists it will overwrite it. If it doesnt exist it will create it: PUT can be used for first time creation and updates also. The difference between a POST and a PUT is that a PUT must have the resource identifier available, whereas a POST will not. So you can only PUT to create a resource if the resource identifier was generated external to the save operation.

PATCH should be used for updating part of the resource - perhaps a single field.

http://martinfowler.com/articles/richardsonMaturityModel.html

No comments:

Post a Comment