httphttp-status-codeshttp-statushttp-status-code-409

HTTP status: 409 vs 428


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?


Solution

  • 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)