10

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?

Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
  • 1
    Many developers just ignore all of these status codes, and they inform the clients by headers instead. But very common codes are still in use of course such as authentication related status. I believe clients(like chrome, ff, etc...) won't even make a one difference between 409 and 428 status codes –  Jul 06 '17 at 20:37

1 Answers1

9

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)

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98
  • Can you please elaborate on **conditional** requests? And what is that related to the *lost update* issue as described in the wikipedia page? – Gelin Luo Jul 06 '17 at 12:51
  • I think he means you use 428 only when you require requests to have "conditional" request header field – Clojurevangelist Jul 12 '17 at 20:50