4xx Client Error
HTTP 428 Precondition Required
The server requires the request to be conditional. This is intended to prevent the 'lost update' problem, where a client GETs a resource, modifies it, and PUTs it back while a third party has modified it.
Common Causes
- Server requires If-Match or If-Unmodified-Since header
- Optimistic concurrency control is enforced
- API mandates conditional requests for write operations
How to Fix
- 1Add an If-Match header with the current ETag
- 2Fetch the resource first to get its ETag, then send conditional request
- 3Include If-Unmodified-Since with the last known modification date
Example
HTTP 428 Precondition Required
PUT /api/doc/1 HTTP/1.1 (no If-Match header) → 428 Precondition Required → "Include If-Match header for updates"
Related Client Error Codes
400
Bad Request
401Unauthorized
402Payment Required
403Forbidden
404Not Found
405Method Not Allowed
406Not Acceptable
407Proxy Authentication Required
408Request Timeout
409Conflict
410Gone
411Length Required
412Precondition Failed
413Content Too Large
414URI Too Long
415Unsupported Media Type
416Range Not Satisfiable
417Expectation Failed
418I'm a Teapot
421Misdirected Request
422Unprocessable Content
423Locked
424Failed Dependency
425Too Early
426Upgrade Required
429Too Many Requests
431Request Header Fields Too Large
451Unavailable For Legal Reasons