From List of HTTP status code (Wikipedia) it says:
409 Conflict
Indicates that the request could not be processed because of conflict in the request, such as an edit conflict between multiple simultaneous updates.
And
428 Precondition Required (RFC 6585)
The origin server requires the request to be conditional. Intended to prevent the 'lost update' problem, where a client GETs a resource's state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict."
However isn't the "lost update" issue mentioned in 428 item exactly the "edit conflict" issue mentioned in 409 item?
So question is what are the differences between the two status code and when should we use which of them?
From List of HTTP status code (Wikipedia)it says: 409 Conflict Indicates that the request could not be processed because of conflict in the request, such as an edit conflict between multiple simultaneous updates. And 428 Precondition Required (RFC 6585) The origin server requires the request to be conditional.
What Is a 428 Status Code? The origin server requires the request to be conditional. Its typical use is to avoid the “lost update” problem, where a client GETs a resource’s state, modifies it, and PUTs it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict.
Of the two codes mentioned, HTTP 403 is far more common and describes a valid (but unauthorized) request HTTP 409 is not very common. It describes a conflict (like a deadlock or some other type of issue) that resulted in an error. I think Mozilla gives good advice when it describes this error most commonly occurring with with the PUT verb.
This status code is primarily intended to be used with the Link header, letting the user agent start preloading resources while the server prepares a response. The request succeeded. The result meaning of "success" depends on the HTTP method:
You send 428 to indicate to the client that you only accept conditional requests.
(Conditional requests are those carrying "conditional" request header fields, as described in https://www.greenbytes.de/tech/webdav/rfc7232.html)
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