Bulk Delete Variables

This endpoint deletes multiple Variables at once.

❗️

+++Attention+++

This endpoint is extremely powerful, and with great power comes great responsibility.

Deleting Variables CANNOT be undone. Back up any Variable data before deleting one or more Variables.

Request

To delete one or more Variables, make a POST request to the following URL:

HTTP MethodURL
POSThttps://industrial.api.ubidots.com/api/v2.0/variables/_/bulk/delete/

To delete one or more Variables in a Device, make a POST request to the following URL:

HTTP MethodURL
POSThttps://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:

ParameterTypeDescription
variable\_idStringThe 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 one safe alternative:

  • Make a GET All Variables request using the query parameter fields=id. This returns an array of the Variable IDs. Copy this array and use it in the body for this endpoint. This helps ensure that only the intended Variables in that array are deleted.

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter

Header

ParameterRequired?Description
X-Auth-TokenYesAuthentication Token of account
X-Bulk-OperationYesNeed to be set to True for the bulk operation to work
Content-TypeYesContent 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 for the asynchronous process.