428 Precondition Required

The server requires the request to be conditional, so unconditional writes are rejected.

Status

HTTP/1.1 428 Precondition Required

Details

428 closes the lost update hole. Without it, two clients can each read a resource, each write it back, and the second write silently discards the first. A server that returns 428 is insisting on If-Match so that a stale write fails with 412 instead of overwriting.

The response should explain which precondition is expected. Clients then re-read the resource, take its ETag, and resend the write conditionally.

Headers

Common causes

How to fix it

As the client

As the server

Examples

PUT /api/docs/91 HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"title":"Updated"}

HTTP/1.1 428 Precondition Required
Content-Type: application/json; charset=utf-8

{"error":"precondition_required","expected":"If-Match"}

Specifications

RFC 6585 §3

See also