Add First¶
Description¶
This operation adds new values to the very beginning of a list.
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]/list/[key]/add-first
where:
Argument | Description |
---|---|
[hive-name] |
Name of a hive where the operation is performed. |
[key] |
Key name identifying a list. |
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 values. Each individual value must of a valid JSON type. For example:
["value1", true, 17, 1.99, ...]
Response Body¶
The number of values in the list after the new values are saved.
Example¶
The example below adds the "Apple"
and "Orange"
values to the very beginning of the fruits
list.
curl --location --request PUT "https://xxxx.backendless.app/api/hive/groceryStore/list/fruits/add-first" \--header 'Content-Type: application/json' \--data-raw '["Apple","Orange"]'
where:
Argument | Description |
---|---|
groceryStore |
Name of a hive where the operation is performed. |
fruits |
Key name identifying a list. |
Codeless Reference¶
where:
Argument | Description |
---|---|
hive name |
Name of a hive where the operation is performed. |
key name |
Key name identifying a list. |
items |
A list of values to add to the list. |
position: first |
Instructs Hive to add the specified items at the beginning of the list. |
Returns the number of values in the list after the new values are saved.
Consider the following List storage:
The example below adds "Apple"
and "Orange"
to the beginning of the list:
After the codeless logic runs, the list in Hive contains the following data: