Difference between PUT vs. POST from a system administrator POV?
https://ibb.co/c3S73K6
These are what I wrote in my college notes of TCP IP that I did 6 years ago.
Much of it is confusing as both seem to be doing the same thing. Can you tell me what’s the benefit of being idempotent? As far as I know idempotent means no matter how many times you repeat a input, you get same output.
5 comments
[ 3.2 ms ] story [ 23.0 ms ] threadPUT is typically used for updating existing entities - the server can determine if the entity exists before updating it - imagine where a record might be tried to update twice. you would expect the same output even if the input was used twice (think poor network connection without an ACK from the server back to the client, so the client retries)
I did POST with cURL in linux to send data to server, what'd have happened if I used PUT. I did it for sending FCM/GCM to android.
Idempotency provides resilience against messages that might be repeated (e.g., at-least-once delivery).
Idempotent operations are also typically structured as absolute, not relative data.
For example, a bank might send a message "set balance to $100", not "subtract $10 from balance" - if the message is repeated, the correct result is still obtained.
But it’s all up to the implementation. I regularly see them misused or everything is a POST. At then end of the day they are functionally equivalent. Idempotency is not often considered outside of specific cases like payment.