Difference between PUT and POST methods
This question can pop up during interview or when you create your own API.
In this article you can find four answers.
POST sends new data to server.
PUT apllies some changes to already existing data.
PUT should be idempotent. It means that multiple identical PUT requests to same endpoint does not change API condition.
POST does not have to be idempotent.
POST suggests, that data is sent in the request's body.
PUT suggests, everything is sent inside URL. No body.
Argument against this version:
HTTP 1.1 allows body for all methods.
GET, HEAD and DELETE does not have body semantics defined, so body is ignored. PUT does not have this feature.
PUT can be considered as a part of CRUD - it covers Create and Update. POST is more problematic if you need to put it to CRUD.
This version is contraversal to 1 where new data creation is associated with POST.
You can practice creating PUT and POST requests here
If you whant to check how HTTP methods work from the iside configure telnet
telnet in Windows
and send requests.
Configuration of telnet in Windows is described here .
As an alternative to telnet sockets can be used.
According to some real life experience difference between POST and PUT can change on different servers.
Logical difference between POST and PUT from GET is obvious - they are addind data and GET fetches data.
PUT and POST can be processed in a manner that is more common for certain developer.
It can be helpful to ask direct questions from software developer.