Insert After¶
Description¶
This operation inserts a new value after an existing value in 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]/insert-after
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 object with the structure shown below:
{
"anchorValue": <any-value>,
"valueToInsert": <any-value>
}
where:
Argument | Description |
---|---|
"anchorValue" |
Value which is used as a position anchor. |
"valueToInsert" |
New value to add to the list. |
Response Body¶
The number of values in the list after the insertion operation is complete.
Example¶
The example below inserts the "Apple"
value right after the "Orange"
value in the fruits
list.
curl --location --request PUT "https://xxxx.backendless.app/api/hive/groceryStore/list/fruits/insert-after" \--header 'Content-Type: application/json' \--data-raw '{"valueToInsert": "Apple","anchorValue": "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. |
item |
New item that must be added to the list. |
after item |
Value which is used as a position anchor. Must be a value that already exists in the list. The new value is insert after this one. |
Returns the number of values in the list after the insertion operation is complete.
Consider the following List storage:
The example below inserts a new item "Apple"
after the selected anchor value "Orange"
:
The list storage will look as shown below after the Codeless logic runs: