Using
Upserts a document. With an `If-Match: "<etag>"` header the write is a conditional update; with `If-None-Match: *` it is create-only. Both may be combined and are evaluated in that order; a failed precondition answers 412 with the current `ETag`.
applies to v0.5.1const url = 'https://example.com/store-api/json/example/documents/example';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/store-api/json/example/documents/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{}'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”JSON domain
Document key
Header Parameters
Section titled “Header Parameters”Opaque ETag from a prior read: write only if it is still the document’s current version, else 412
Only * is supported: create-only write, 412 if the document exists. Evaluated after If-Match
Request Bodyrequired
Section titled “Request Bodyrequired”object
Example generated
{}Responses
Section titled “Responses”Document updated
A document as returned by the store: _key/_version metadata merged
into the user’s fields.
object
Document key.
Write counter: 1 on create, incremented on every write.
The document’s own fields. A document whose content is not a JSON
object appears as a single _content field holding that value.
Example generated
{ "_key": "example", "_version": 1}Document created
A document as returned by the store: _key/_version metadata merged
into the user’s fields.
object
Document key.
Write counter: 1 on create, incremented on every write.
The document’s own fields. A document whose content is not a JSON
object appears as a single _content field holding that value.
Example generated
{ "_key": "example", "_version": 1}Invalid key, reserved top-level field (_key, _version, _content), or invalid If-Match or If-None-Match header
Domain not found
Domain is being deleted
If-Match or If-None-Match does not hold (version mismatch, missing document, or document already exists); nothing was written
Headers
Section titled “Headers”ETag of the document’s current version; absent when the document does not exist
The domain requires conditional writes and neither If-Match nor If-None-Match is set
Headers
Section titled “Headers”No-store
JSON engine disabled
Insufficient Storage — disk space or memory runs short; the write was not applied. Reads go on; retry after the seconds in Retry-After.