Check If Keys Exist¶
Description¶
This operation checks if specific keys exist in the specified store.
Method¶
POST
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]/[bucket-type]/action/exist
where:
Argument | Description |
---|---|
[hive-name] |
Name of a hive where the operation is performed. |
[bucket-type] |
Storage type in the[hive-name] Hive where the check is performed. Acceptable values are list , key-value , map , set or sorted-set . |
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 array of string values.
["key1", "key2", ...]
Response Body¶
Number of found keys. Otherwise, 0
is returned if the specified keys do not exist.
Example¶
Check Multiple Keys
The example below checks if the "fruits"
and "vegetables"
keys exist in the listkey-value store.
curl --location --request POST "https://xxxx.backendless.app/api/hive/groceryStore/list/action/exist" \--header 'Content-Type: application/json' \--data-raw '["fruits","vegetables"]'
where:
Argument | Description |
---|---|
groceryStore |
Name of the hive where the operation is performed. |
["fruits","vegetables"] |
An array of key names to check for existence. |
Codeless Reference¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
type |
Storage type, can be one of the following: Key / Value, Sorted Set, Set, Map, List. |
keys |
An array of keys to check for existence. |
Returns the number of found keys. Otherwise, 0
is returned if the specified keys do not exist.
Consider the following Key Value storage:
The example below checks if the "Japan"
and "USA"
keys exist in the the Key Value storage of the countries
hive. The block returns a number of keys found in the store.
The output will look as shown below after the Codeless logic runs.
To check for a single key, use the following block. The blocks returns a boolean true
or false
value indicating whether the specific key exists in the store.
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
type |
Type of the storage used for this operation. |
key name |
Key name to check for existence. |
The example below checks if the "Japan"
key exists in the Key / Value
store of the countries
hive:
The output will look as shown below after the Codeless logic runs.