For a PUT request: HTTP 200, HTTP 204 should imply "resource updated successfully". HTTP 201 if the PUT request created a new resource. For a DELETE request: HTTP 200 or HTTP 204 should imply "resource deleted successfully".
Error 501 is a HyperText Transfer Protocol (HTTP) status code that stands for Not Implemented. This server error response code means that your web server does not support the functionality required for access and does not recognize the request method.
Assume I'd like to implement some kind of optimistic locking and use ETags to indicate the most up to date resource state. This means, clients will use an If-Match
header when PUT
ting for an update.
According to the HTTP spec, the server has to return 412 Precondition failed
if the ETag provided for the If-Match
header doesn't match the current state of the resource.
However, 409 Conflict
seems to be closer to what I want to express semantically, especially as it gives guidelines what to include in the response.
Is it terribly wrong to rather return 409
in case of a failure to match an ETag provided in an If-Match
header?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With