Learn how to take advantage of the HTTP cache to reduce bandwidth.
ETag
header that identifies the specific version of a resource. Each time the corresponding resource changes, a new ETag is generated. As such, comparing ETags indicates whether the representation of a resource has changed.
If-Match: <etag_value> || W/"<etag_value>
: Requests only succeeds if the latest version exactly matches the given ETag value.If-None-Match: <etag_value> || W/"<etag_value>
: Request only succeeds if the latest version does not match the given Etag value.304 Not Modified
or a 412 Precondition Failed
HTTP status code response (examples below).
The If-Match
HTTP Header can be used on write requests (POST, PUT, PATCH, DELETE) in order to only apply them if the resource was not changed by someone else since it was retrieved.
If-None-Match
HTTP Header can be used on read requests (GET, HEAD) in order to only retrieve the representation of the resource if it has changed since the last time it was retrieved.