4xx Client Error
You said 'only do this if that thing is true', but that thing turned out to be false, so I didn't do anything.
Use 412 when the client supplied a conditional header and that precondition evaluated to false.
PUT https://api.example.test/api/users/123
# Headers
If-Match: "old-etag"412 Precondition Failed
# Headers
Content-Type: application/json
# Body
{
"error": "precondition_failed"
}Resource was modified since client last fetched it, ETag no longer matches
There's a conflict - what you're trying to do clashes with something that already exists or the current state.
You're trying to change something, but you need to tell me what you expect it to look like first, so we don't accidentally overwrite someone else's changes.
You already have the latest version! The thing you're asking for hasn't changed since you last got it.