HTTP status: 409 vs 428
Asked Answered
X

1

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?

Xeroderma answered 6/7, 2017 at 10:32 Comment(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 codesKwiatkowski
P
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)

Pristine answered 6/7, 2017 at 12:39 Comment(2)
Can you please elaborate on conditional requests? And what is that related to the lost update issue as described in the wikipedia page?Xeroderma
I think he means you use 428 only when you require requests to have "conditional" request header fieldKoralle

© 2022 - 2024 — McMap. All rights reserved.