This endpoint deletes multiple Organizations at once.
+++Attention+++
This endpoint is extremely powerful. But with great power comes a great responsibility.
Deleting Organizations CANNOT be undone. Please backup any Organizations data before deleting one or more Organization(s).
Request
To delete one or more Organization(s) please make a POST request to the following URL:
HTTP Method | URL |
---|---|
POST | https://industrial.api.ubidots.com/api/v2.0/organizations/_/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 <organization_key>
. Each <organization_key>
object can contain the following body parameters:
Parameter | Type | Description |
---|---|---|
organization_key | String | The id or label of the Organization, label should use the prefix ~ |
<organization_key>
Remember that the
<organization_key>
has 3 valid formats:
-<organization_id> :"6e3wef09da44fc8455a9cceb5aa"
-<organization_label>:"~second-variable"
//Remember to add the ~ before the Variable label
-JSON of <organization_id>:{ "id": "1237809ca5pIhpjgc345fc" }
+++ATTENTION+++
Please be VERY careful using this endpoint, why? Because it's possible to delete many Organizations at once.
We propose 1 safe alternatives:
- Do a GET All Organizations request using the query parameter
fields=id
. This returns an Array of the Organization Ids. Simply copy this Array and use it in the body for this endpoint. Thus, you make sure that only the intended Organizations 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/organizations/_/bulk/delete/' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-H 'Content-Type: application/json' \
-H 'X-Bulk-Operation: True' \
-d '[
"6e309da44fc8455a9cceb5aa",
"~second-organization",
"~third-organization",
{
"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.