Skip to main content

Remove element

Description#

Use a HTTP POST request to remove a top level element from an array or key from an object in a resource. The request returns the removed item.

Request#

HTTP Method: POST

ParameterDescription
idThe ID of the resource.
keyThe object key to remove if removing from an object.
indexThe index of the element to remove if removing from an array (with indexes starting at 0).

Sample request#

Sample request for an array element

curl -X POST \  https://<tenant-domain>/api/v1/global_resources/<resource-id>/remove \  -H 'content-type: application/json' \  -H 'x-user-email: <email-address>' \  -H 'x-user-token: <api-token>' \  -d '{        "index":"0"    }'

Sample request for an object key

curl -X POST \  https://<tenant-domain>/api/v1/global_resources/<resource-id>/remove \  -H 'content-type: application/json' \  -H 'x-user-email: <email-address>' \  -H 'x-user-token: <api-token>' \  -d '{        "key":"foo"    }'

Response#

A successful request will return the removed item from the resource in string format.

Sample response#

"foo bar"