Difference between PUT and POST method
PUT Request |
Post Request |
---|---|
This method is idempotent. |
This method is not idempotent. |
PUT method is call when you have to modify a single resource, which is already a part of resource collection. |
POST method is call when you have to add a child resource under resources collection. |
RFC-2616 depicts that the PUT method sends a request for an enclosed entity stored in the supplied request URI. |
This method requests the server to accept the entity which is enclosed in the request. |
PUT method syntax is PUT /questions/{question-id} |
POST method syntax is POST /questions |
You can not cache PUT method responses. |
POST method answer can be cached. |
PUT /vi/juice/orders/1234 indicates that you are updating a resource which is identified by “1234”. |
POST /vi/juice/orders indicates that you are creating a new resource and return an identifier to describe the resource. |
If you send the same request multiple times, the result will remain the same. |
If you send the same POST request more than one time, you will receive different results. |
PUT works as specific. |
POST work as abstract. |
We use UPDATE query in PUT. |
We use create query in POST. |
In PUT method, the client decides which URI resource should have. |
In POST method, the server decides which URI resource should have. |
Difference between PUT and POST HTTP Request in Express and Postman
Both PUT and POST are request methods used in the HTTP protocol. In this article, we will introduce the HTTP methods such as PUT and POST in detail, and we will also discuss in detail when to use PUT and when to use POST.
Table of Content
- PUT method
- POST Method
- Difference between PUT and POST method
- Conclusion
Contact Us