Returns the versioned document with its ETag
Reads If-None-Match: when it matches the current ETag (weak comparison, * matches anything), the response is 304 with no body. The ETag has the form "doc-v{version}". Also answers HEAD.
Note: Send the returned ETag back in If-None-Match to get 304 Not Modified.
Parameters 1
| Name | Type | Description |
|---|---|---|
If-None-Match | header · string | ETag from a previous response; a match returns 304 Not Modified. |
Responses
- 200
- The document, with ETag and Cache-Control: no-cache.
- 304
- The client's copy is current.
Example
Request
curl -X GET "https://api.testingapis.com/api/cache/etag" \
-H "X-TestingApis-Key: YOUR_API_KEY"Response200 OK
ETag: "doc-v1"
Cache-Control: no-cache
{
"id": 1,
"version": 1,
"title": "TestingAPIs cached document",
"content": "Send If-None-Match to get a 304, and If-Match on PUT to make a conditional update.",
"updatedAt": "2025-01-01T00:00:00Z",
"etag": "\"doc-v1\""
}Sign in to see the details
The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.