TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Updates the document only if the client's ETag is current

PUThttps://api.testingapis.com/api/cache/etagSign in to see this endpoint's URL

Requires If-Match with the current ETag (strong comparison, so W/ tags never match; * matches). A successful update increments the version and returns the new ETag. Use it to test lost-update protection.

Note: Send the current ETag (from GET /api/cache/etag) in If-Match. Missing -> 428, stale -> 412.Note: Send the current ETag (from GET …) in If-Match. Missing -> 428, stale -> 412.

Parameters 1

NameTypeDescription
If-Matchheader · stringCurrent ETag. Missing returns 428, stale returns 412.

Request body

Optional. application/json, text/json, application/*+json, application/xml, text/xml, application/*+xml. Model: CachingControllerDocumentUpdate. New title and/or content.

Example body
{"title": "Updated title", "content": "New content"}

Responses

200
Updated; the new ETag is in the header and body.
400
Neither title nor content supplied, or malformed body.
412
If-Match does not match the current ETag.
428
If-Match header missing.

Example

Request
curl -X PUT "https://api.testingapis.com/api/cache/etag" \
  -H "Content-Type: application/json" \
  -H "If-Match: "doc-v1"" \
  -d '{"title": "Updated title", "content": "New content"}' \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
ETag: "doc-v2"

{
  "message": "Document updated",
  "data": {
    "id": 1,
    "version": 2,
    "title": "Updated title",
    "content": "New content",
    "updatedAt": "2026-09-30T18:26:44Z",
    "etag": "\"doc-v2\""
  }
}

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.