what is difference between PUT and POST ?
Differences between PUT and POST in REST APIs
Here is the important difference between PUT and POST method:
PUT |
POST |
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 /employee/{employee-id} |
POST
method syntax is POST /employee |
PUT
method answer can be cached. |
You
cannot cache PUT method responses. |
We
use update or replace operation
for CURD . |
We
use for create operation for CURD. |
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. |
No comments:
Add your comment