Last post Feb 21, 2017 09:16 AM by PatriceSc
Feb 21, 2017 08:12 AM|mamoni.kol2017|LINK
i searched google a lot still got no good explanation with example. mostly all write up is saying put is idempotent and post is not but i need a sample code which discuss or show idempotency of put method. so my request anyone can explain the put idempotency
with example code or redirect me to right article link which discuss the same with example code. thanks
Feb 21, 2017 09:16 AM|PatriceSc|LINK
It comes from
You don't find any sample code because it is just a specification. Once again technically speaking you can do absolutely whatever you want in response to a put request. But following the specification PUT is supposed to be used this way :
"The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin
server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI."
So in short it is to update (or create) something at a supplied uri. So if you do that several time you'll just update (or create then update) the same way the same resource and issuing the request one time or multiple times won't make a difference (ie it
Then the idea is just to reuse this existing "standard" rather than inventing again some other new convention. So PUT should be used to update (or even create) something at a know and fixed location.
There is really nothing more to understand. It is not a technical limitation. It is just that you have a specification that tells what PUT is supposed to do and it is likely best to follow this specification rather than reinventing your own for your web