412 Precondition Failed
The HTTP status meaning a condition in the request headers, such as If-Match, was not true, so nothing was changed.
In more detail
It protects writes from lost updates: if the ETag the client sends in If-Match no longer matches the current version, the server refuses the update instead of overwriting someone else’s change. The client should read the resource again, reapply its change and retry with the new ETag.
Related terms
- If-Match — The request header that makes a write conditional: the server applies it only if the resource still has the ETag the client sends.
- ETag — A response header holding an opaque tag that names one exact version of a representation, such as ETag: "1".
- optimistic concurrency control — A way to prevent lost updates by reading a version, preparing a change, and making the write succeed only if that version is still current.
Taught in
- HTTP Methods And Status Codes — Modern API Architecture: REST, GraphQL & gRPC
- Caching And Conditional Requests — Modern API Architecture: REST, GraphQL & gRPC