3 ms·
If "idempotent" means "do the same thing", one would expect the same response on a subsequent call, no? "Do the same thing" isn't specific enough. Does it mean
by JMTQp8lwXL 7y ago
If "idempotent" means "do the same thing", one would expect the same response on a subsequent call, no?
"Do the same thing" isn't specific enough. Does it mean the state of the system? Does it mean the response code? Does it mean the response body? Does it mean all of these things? All seem like reasonable interpretations.
- alkonaut 7y agoIn the context of REST it means the same server state (a database table state, a mailbox state, file system state etc) It doesn’t mean “do the same thing” or “get the same response”, only “end up in the same place”. You can do a delete x, get an OK response, and the important state is that x is now deleted on the server. Then the next call to delete x does nothing (which is different from the first which deleted x!). So to be idempotent it has to do something different. The response in the second case can be both “ok” (because the thing is deleted) but also e.g “x doesn’t exist”.