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