Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 968
Gelin Luo Avatar asked Jul 06 '17 10:07

Gelin Luo


People also ask

What does the HTTP status 409 Conflict and 428 mean?

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 and how to fix it?

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.

What is the difference between HTTP 403 and HTTP 409?

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.

What does the HTTP status code success mean?

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:


1 Answers

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)

like image 128
Julian Reschke Avatar answered Oct 11 '22 00:10

Julian Reschke