Skip to content

Latest commit

 

History

History
194 lines (145 loc) · 4.56 KB

KvStoreItemApi.md

File metadata and controls

194 lines (145 loc) · 4.56 KB

Fastly.KvStoreItemApi

const apiInstance = new Fastly.KvStoreItemApi();

Methods

Note

All URIs are relative to https://api.fastly.com

Method HTTP request Description
kvStoreDeleteItem DELETE /resources/stores/kv/{store_id}/keys/{key} Delete an item.
kvStoreGetItem GET /resources/stores/kv/{store_id}/keys/{key} Get an item.
kvStoreListItemKeys GET /resources/stores/kv/{store_id}/keys List item keys.
kvStoreUpsertItem PUT /resources/stores/kv/{store_id}/keys/{key} Insert or update an item.

kvStoreDeleteItem

kvStoreDeleteItem({ store_id, key, [if_generation_match, ][force] })

Delete an item.

Example

const options = {
  store_id: "store_id_example", // required
  key: "key_example", // required
  if_generation_match: 56,
  force: false,
};

apiInstance.kvStoreDeleteItem(options)
  .then(() => {
    console.log('API called successfully.');
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
store_id String
key String
if_generation_match Number [optional]
force Boolean [optional] [defaults to false]

Return type

null (empty response body)

kvStoreGetItem

kvStoreGetItem({ store_id, key })

Get an item, including its value, metadata (if any), and generation marker.

Example

const options = {
  store_id: "store_id_example", // required
  key: "key_example", // required
};

apiInstance.kvStoreGetItem(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
store_id String
key String

Return type

File

kvStoreListItemKeys

kvStoreListItemKeys({ store_id, [cursor, ][limit, ][prefix, ][consistency] })

Lists the matching item keys (or all item keys, if no prefix is supplied).

Example

const options = {
  store_id: "store_id_example", // required
  cursor: "cursor_example",
  limit: 100,
  prefix: "prefix_example",
  consistency: "strong",
};

apiInstance.kvStoreListItemKeys(options)
  .then((data) => {
    console.log(data, "API called successfully.");
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
store_id String
cursor String [optional]
limit Number [optional] [defaults to 100]
prefix String [optional]
consistency String [optional] [one of: "strong", "eventual"]

Return type

InlineResponse2004

kvStoreUpsertItem

kvStoreUpsertItem({ store_id, key, [if_generation_match, ][time_to_live_sec, ][metadata, ][add, ][append, ][prepend, ][background_fetch, ][body] })

Inserts or updates an item's value and metadata.

Example

const options = {
  store_id: "store_id_example", // required
  key: "key_example", // required
  if_generation_match: 56,
  time_to_live_sec: 56,
  metadata: "metadata_example",
  add: false,
  append: false,
  prepend: false,
  background_fetch: false,
  body: "/path/to/file",
};

apiInstance.kvStoreUpsertItem(options)
  .then(() => {
    console.log('API called successfully.');
  })
  .catch((error) => {
    console.error(error);
  });

Options

Name Type Description Notes
store_id String
key String
if_generation_match Number [optional]
time_to_live_sec Number [optional]
metadata String [optional]
add Boolean [optional] [defaults to false]
append Boolean [optional] [defaults to false]
prepend Boolean [optional] [defaults to false]
background_fetch Boolean [optional] [defaults to false]
body File****File [optional]

Return type

null (empty response body)

[Back to top] [Back to API list] [Back to README]