Protocols
Saved & recent

Conditional requests

Also called: HTTP preconditions, ETag, If-Match, If-None-Match

A conditional HTTP request includes a precondition that the server evaluates before applying the operation. Validators such as entity tags, or ETags, identify a representation’s version. Conditionals can avoid transferring unchanged content or prevent an edit from silently overwriting someone else’s update.

Suppose two editors read revision "r4". One saves a change that produces "r5". The other sends PUT with If-Match: "r4"; the server can reject the stale edit with 412. For caching, GET with If-None-Match can instead receive 304 when the stored representation remains usable.

Read first
HTTP headers
Related
HTTP caching, Idempotency, HTTP status codes
Further reading
editor A stored resource editor B starts from “r4” starts from “r4” A saves a change saved · ETag: "r5" PUT · If-Match: "r4" 412 Precondition Failed ETag: "r5" stored revision preserved
Both editors read ETag “r4”. A’s save produces “r5”; B’s later If-Match: “r4” fails with 412, preserving A’s revision. These labels are illustrative opaque entity tags.

View in the full Protocols collection