Skip to content

Get Values

Description

This operation returns multiple key-value pairs for the specified key names.

Method

Backendless.Hive(hiveName).KeyValueStore().multiGet(keys);

where:

Argument                Description
hiveName Name of a hive where the operation is performed. String value.
keys An array of key names identifying the key-value pairs. String values.

Return Value

An object with keys from the request body and the corresponding values. In case the specified keys do not exist, the operation returns an empty object.

Example

Consider the following key-value store:

key-value-store

The example below retrieves values for the "USA" and "Japan" key names:

Set<String> keys = new HashSet<>();
keys.add("USA");
keys.add("Japan");

Backendless.Hive("countries").KeyValueStore().multiGet(keys);

where:

Argument                Description
"countries" Name of a hive where the operation is performed.
["USA","Japan"] Array containing key names to get the corresponding values for.

Response

{  
  "USA": "Washington DC",  
  "Japan": "Tokyo"  
}

Codeless Reference

keyvalue_api_get_values

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key names Key names identifying key-value pairs.

Returns key-value pairs for the specified keys.

Consider the following Key Value storage:

sample-key-value

The example below gets two key-value pairs for the specified keys ("USA" and "Japan"):

keyvalue_api_example_get_values
The output will look as shown below after the Codeless logic runs.
keyvalue_api_example_get_values_2