KV store item

These endpoints are used to list, create, update, and delete items in a KV store.

An item in a KV store consists of a key, a value, optional metadata, optional "time to live", and a generation marker.

Metadata

The metadata can contain up to 2,000 bytes, and is stored and retrieved alongside the item's value. Since it is transferred to and from the KV store using an HTTP header, the contents must be compatible with the requirements for an HTTP header value (generally limited to a UTF-8 encoded string, but must not contain CR or LF characters).

Generation Marker

Each key has a generation marker, which is a 64-bit unsigned integer. The marker changes every time the key's value, metadata, or both, are updated. The marker values have no meaning of their own and are only used to indicate that the key's value or metadata have changed.

When a key is read from the KV store, the generation marker will be included in a HTTP header in the response (as described below).

When a modifying (write or delete) operation is submitted to the KV store for a key, the request can include a generation marker value (from a previous read of the key) in an HTTP header (as described below), which indicates to the KV store that the modification should not be performed unless the current generation marker for that key matches the one supplied in the request. This mechanism allows the user of the KV store to ensure that the modification does not overwrite or delete the value or metadata written by another user in between the time that the key was read and the time that the modifying operation was submitted.

Batch insert/update request

background_fetchbooleanIf set to true, the new value for the item will not be immediately visible to other users of the KV store; they will receive the existing (stale) value while the platform updates cached copies. Setting this to true ensures that other users of the KV store will receive responses to 'get' operations for this item quickly, although they will be slightly out of date. [Default false]
keystringThe key of the item to be added, updated, retrieved, or deleted. Required.
metadatastringAn arbitrary data field which can contain up to 2000 bytes of data.
time_to_live_secintegerIndicates that the item should be deleted after the specified number of seconds have elapsed. Deletion is not immediate but will occur within 24 hours of the requested expiration.
valuestringValue for the item (in Base64 encoding). Required.

Endpoints

List item keys

GET/resources/stores/kv/store_id/keys

Get an item

GET/resources/stores/kv/store_id/keys/key

Insert or update an item

PUT/resources/stores/kv/store_id/keys/key

Delete an item

DELETE/resources/stores/kv/store_id/keys/key

Insert or update multiple items

PUT/resources/stores/kv/store_id/batch