Skip to content

Contains

Description

This operation checks if specific values exist in a set.

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]/set/[key]/contains

where:

Argument                Description
[hive-name] Name of a hive where the operation is performed.
[key] Key name identifying a 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 an array containing JSON values to check if they are in the set:

["value1", true, 1, "bob", 2.9 ...]

Response Body

A JSON array containing boolean values. For every specified item, a boolean value is returned indicating if it is present in the set or not. If an item exists, then true is returned in the array, false otherwise.

Example

Check Multiple Values

The example below verifies if the "Sedan" and "Crossover" values exist in the cars set.

curl --location --request POST "https://xxxx.backendless.app/api/hive/transport/set/cars/contains" \--header 'Content-Type: application/json' \--data-raw '["Sedan", "Crossover"]'

where:

Argument                Description
transport Name of a hive where the operation is performed.
cars Key name identifying a set.

Codeless Reference

set_api_contains

where:

Argument                Description
hive name Name of a hive where the operation is performed.
key name Key name identifying a set.
items A list of values to check if they exist.

Returns a list containing boolean value(s). For every specified item, a boolean value is returned indicating if it is present in the set or not. If an item exists, then true is returned in the array, false otherwise.

Consider the following Set storage:
set_api_example_all_blocks

The example below checks if "Sedan" and "Crossover" exist in the "cars" set:
set_api_example_contains

The logic produces the following output:

set_api_example_contains_2