428 Precondition Required
To avoid multiple users writing to the same resources and overwriting each
others changes, its useful to take advantage of conditional requests, using
These headers are opt-in though. If a server wants to force a client to use
them, a server can return
428 Precondition Required. Forcing clients to use
Etags and precondition means there’s a lower chance of clients overwriting
changes, because they are forced to to consider the current state of the
service before changing something.
412 Precondition Failed is a bit different, as that status code is only
used when a client did submit precondition headers, but the headers didn’t
match the current state of the resource.
PUT /foo.txt HTTP/1.1 Content-Type: text/plain Hello world
HTTP/1.1 428 Precondition Required Content-Type text/plain Please try submitting this request again with a If-Match header
- RFC6585, Section 3 - 428 Precondition Required