What is the ETag header?
The ETag (Entity Tag) response header is a unique string hash representing the current state of a resource. If the resource data changes, the ETag changes.
API Usage & Best Practices
- Saves bandwidth: Clients save the ETag and send it back on subsequent requests in the
If-None-Matchheader. If the data is unchanged, the server responds with304 Not Modifiedinstead of rebuilding and sending the JSON. - Optimistic concurrency: Can be used alongside
If-Matchto prevent clients from overwriting each other’s edits.
Examples
HTTP/1.1 200 OKETag: "w/3a84e27f01"