Nov 10, 2018

Put vs Post in RESTFUL ( HTTP )

PUT is idempotent, you can put as many times as you want. This is useful when you are in doubt whether you have successfully put the object or not. It is good idea to use PUT when possible. POST on the other hand is not idempotent.

Both PUT and POST can be used for creating. You can only use PUT if you want to create object while specifying the name. POST on the other hand will return the new object's URL to you. You will get a Not Found error if you use POST to create a new object with a name.

PUT can be used to update or create a resource with the same URL.