Skip to content

Set Keys and Values

Description

This operation modifies values associated with one or more keys.  If the specified keys do not exist, new key-value pairs are created.

Method

PUT

Endpoint URL

Important

Make sure to replace xxxx in the domain name in the request specification below to the one assigned to your application.

https://xxxx.backendless.app/api/hive/[hive-name]/key-value

where:

Argument                Description
[hive-name] Name of a hive where the operation is performed.

Request Headers

Content-Type:application/json

where:

Argument                Description
Content-Type Must be set to application/json. This header is mandatory.

Request Body

The request body must be a JSON object with the structure shown below:

{  
    "key1":"value1",  
    "key2":"value2"  
}

Response Body

None.

Example

The example below modifies values associated with the keys "Japan" and "USA". In case the keys do not exist, new key-value pairs are created.

curl --location --request PUT "https://xxxx.backendless.app/api/hive/countries/key-value" \--header 'Content-Type: application/json' \--data-raw '{"Japan": "The land of the rising sun","USA": "The country of freedom"}'

where:

Argument                Description
countries Name of a hive where the operation is performed.
"Japan","USA" Keys to update the values of. If the keys do not exist, new key-value pairs are created.
"The land of the rising sun","The country of freedom" Values to assign to the keys.

Codeless Reference

keyvalue_api_set_keys_and_values

where:

Argument                Description
hive name Name of a hive where the operation is performed.
keys/values object An object containing key names and corresponding values.

Consider the following Key Value storage:

sample-key-value

The following example sets key-value pairs:

keyvalue_api_example_set_keys_and_values


The key-value storage will look as shown below after the Codeless logic runs:
keyvalue_api_example_set_keys_and_values_2