What is diference between PUT and POST request?


The HTTP methods, POST and PUT serve a different purpose.

PUT puts a file or resource at a specific URI. If there's already a file or resource at that URI, PUT replaces that file or resource. If there is no file or resource there, PUT creates one.

For example: - If you know the where the product resides at i.e http://www.shopexample.com/product/1234 , you can use PUT method to update the resource.

In another hand POST method is used to add the new product if we don't know the actual resource location and we let the server decide where it should store it.

Hence PUT is idempotent, while POST is not.

Share this thread


comments powered by Disqus


Social Media