- Home
- Tools
- Developer Tools
- HTTP Status Codes
- 428 Precondition Required
428 Precondition Required
The server only accepts this request with a condition attached, such as an If-Match header, so that changes can't overwrite each other.
- Class
- 4xx Client error. The request is the problem: a wrong address, missing credentials, data the server can't accept.
- Defined in
- RFC 6585
What causes it
When an API wants protection against lost updates. Two clients fetch the same record, both change it and both save, and the second save silently wipes out the first. A server that requires If-Match, with the ETag of the version being changed, refuses requests without it with a 428.
What to do about it
Fetch the resource, take the ETag from the response and send your change with an If-Match header that holds it. If someone else was quicker you get a 412, and you fetch again. If you build the API, say in the body which header is missing.
Not to be confused with
| 412 Precondition Failed | The condition was sent and turned out to be false. |
|---|---|
| 409 Conflict | A conflict found without the help of a condition. |
All codes are on the list of HTTP status codes, which can be searched by number and by word.
Other 4xx codes
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 412 Precondition Failed
- 413 Content Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 I'm a teapot
- 421 Misdirected Request
- 422 Unprocessable Content
- 423 Locked
- 424 Failed Dependency
- 425 Too Early
- 426 Upgrade Required
- 429 Too Many Requests
- 431 Request Header Fields Too Large
- 451 Unavailable For Legal Reasons