28 June 2015

POST vs PUT in Rest

POST vs PUT in Rest 

Example :

"POST /books" with a bunch of book information might create a new book, and respond with the new URL identifying that book: "/books/5".

"PUT /books/5" would have to either create a new book with the id of 5, or replace the existing book with ID 5.
In non-resource style, POST can be used for just about anything that has a side effect. One other difference is that PUT should be idempotent - multiple PUTs of the same data to the same URL should be fine, whereas multiple POSTs might create multiple objects or whatever it is your POST action does.


No comments:

Post a Comment

Comments Welcome

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...