This endpoint deletes multiple Variables at once.
+++Attention+++
This endpoint is extremely powerful. But with great power comes a great responsibility.
Deleting Variables CANNOT be undone. Please backup any Variable data before deleting one or more Variables.
Request
To delete one or more Variables please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v2.0/variables/_/bulk/delete/ |
To delete one or more Variables in a Device please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v2.0/devices/<device_key>/variables/_/bulk/delete |
It's a POST
Please note that it's a POST request and not a DELETE request.
Body Parameters
The body is an Array containing one or more <variable_key>
. Each <variable_key>
object can contain the following body parameters:
Parameter | Type | Description |
---|---|---|
variable_id | String | The id of the Variable |
<variable_key>
Remember that the
<variable_id>
has 2 valid formats:
-<variable_id> :"6e3wef09da44fc8455a9cceb5aa"
-JSON of <variable_id>:{ "id": "1237809ca5pIhpjgc345fc" }
+++ATTENTION+++
Please be VERY careful using this endpoint, why? Because it's possible to delete many Variables at once.
We propose 1 safe alternatives:
- Do a GET All Variables request using the query parameter
fields=id
. This returns an Array of the Variable Ids. Simply copy this Array and use it in the body for this endpoint. Thus, you make sure that only the intended Variables in that Array are deleted and not any other.
Query Parameters
Parameter | Type | Use | Description |
---|---|---|---|
token | String | Authentication | Authentication Token can optionally be sent as a query parameter |
Header
Parameter | Required? | Description |
---|---|---|
X-Auth-Token | Yes | Authentication Token of account |
X-Bulk-Operation | Yes | Need to be set to True for the bulk operation to work |
Content-Type | Yes | Content type of body |
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/variables/_/bulk/delete/' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-H 'Content-Type: application/json' \
-H 'X-Bulk-Operation: True' \
-d '[
"6e309da44fc8455a9cceb5aa",
{
"id": "1237809ca5pIhpjgc345fc"
}
]'
{
"task": {
"id": "tyg54645501a9ca5714e7b098721"
}
}
{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}
{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}
{
"detail": "Header `X-BULK-OPERATION` should be provided for bulk operation."
}
Response
Returns a Task Id of the asynchronous process.