Rate this page:

KeyValueStorage

Methods

SetKeyValueItem

Copy URL

Creates or updates a key-value pair. If an existing key is passed, the method will return the existing item and will change the value if needed. The keys should be unique within a Voximplant application.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
SetKeyValueItem example

SetKeyValueItem example

SetKeyValueItem example.

Parameters

  • key:

    string

    Key, up to 200 characters. A key can contain a namespace that is written before the ':' symbol, for example, test:1234. Thus, namespace 'test' can be used as a pattern in the GetKeyValueItems and GetKeyValueKeys methods to find the keys with the same namespace

  • value:

    string

    Value for the specified key, up to 2000 characters

  • application_id:

    number

    The application ID

  • application_name:

    string

    Optional

    The application name

  • ttl:

    number

    Optional

    Key expiry time in seconds. The value is in range of 0..7,776,000 (90 days), the default value is 30 days (2,592,000 seconds). The TTL is converted to an expires_at Unix timestamp field as part of the storage object. Note that one of the two parameters (ttl or expires_at) must be set

  • expires_at:

    number

    Optional

    Expiration date based on ttl (timestamp without milliseconds). Note that one of the two parameters (ttl or expires_at) must be set

Returns

DelKeyValueItem

Copy URL

Deletes the specified key-value pair from the storage.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
DelKeyValueItem example

DelKeyValueItem example

DelKeyValueItem example.

Parameters

  • key:

    string

    Key, up to 200 characters

  • application_id:

    number

    The application ID

  • application_name:

    string

    Optional

    The application name

Returns

  • result:

    number

GetKeyValueItem

Copy URL

Gets the specified key-value pair from the storage.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
GetKeyValueItem example

GetKeyValueItem example

GetKeyValueItem example.

Parameters

  • key:

    string

    Key, up to 200 characters

  • application_id:

    number

    The application ID

  • application_name:

    string

    Optional

    The application name

Returns

GetKeyValueItems

Copy URL

Gets all the key-value pairs in which the keys begin with a pattern.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
GetKeyValueItems example

GetKeyValueItems example

GetKeyValueItems example.

Parameters

  • key:

    string

    Namespace that keys should contain, up to 200 characters

  • count:

    number

    Optional

    Number of items to show per page with a maximum value of 50. Default value is 10

  • offset:

    number

    Optional

    Number of items to skip (e.g. if you set count = 20 and offset = 0 the first time, the next time, offset has to be equal to 20 to skip the items shown earlier). Default value is 0

  • application_id:

    number

    The application ID

  • application_name:

    string

    Optional

    The application name

Returns

GetKeyValueKeys

Copy URL

Gets all the keys of key-value pairs.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
GetKeyValueKeys example

GetKeyValueKeys example

GetKeyValueKeys example.

Parameters

  • key:

    string

    Optional

    Namespace that keys should contain, up to 200 characters

  • count:

    number

    Optional

    Number of items to show per page with a maximum value of 50. Default value is 10

  • offset:

    number

    Optional

    Number of items to skip (e.g. if you set count = 20 and offset = 0 the first time, the next time, offset has to be equal to 20 to skip the items shown earlier). Default value is 0

  • application_id:

    number

    The application ID

  • application_name:

    string

    Optional

    The application name

Returns