Add Values¶
Description¶
This operation adds new elements to a set. Duplicate values are ignored.
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]/set/[key]/add
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.
["value1", 1, "bob", 1.99, true ...]
Response Body¶
Number of elements added to the set.
Example¶
Add Multiple Values
The example below adds new values "SUV"
and "Coupe"
to the cars
set.
curl --location --request PUT "https://xxxx.backendless.app/api/hive/transport/set/cars/add" \--header 'Content-Type: application/json' \--data-raw '["SUV", "Coupe"]'
where:
Argument | Description |
---|---|
transport |
Name of a hive where the operation is performed. |
cars |
Key name identifying a set. |
Codeless Reference¶
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 items to add to the set. |
Returns the number of elements added to the set.
Consider the following Set storage:
The example below adds "SUV"
and "Coupe"
to the "cars"
set:
The set will look as shown below after the Codeless logic runs: