4 ms·
> My understanding is that POST should edit/modify while PUT creates/replaces a resource The way I've been segmented them is based on idempotency. If you repe
by capableweb 3y ago
> My understanding is that POST should edit/modify while PUT creates/replaces a resource
The way I've been segmented them is based on idempotency.
If you repeat the same call multiple times, do you get the same result as if you just ran it once? Then PUT is appropriate.
But if you have side-effects like creating new resources, that would result in different action each time you make the call, then POST it is.
Idempotent methods include GET, HEAD, PUT and DELETE, the resource should always end up in the same state after calling them N times (barring errors/exceptions and such of course). I'm fairly I got this from when I initially read the specification, it's probably mentioned with a bit more grace in the HTTP/1.1 spec.