This endpoint updates the Variable fields specified in the body for multiple Variables at once.
Updating a Single Field
To update only a single field of a Variable, please use the PATCH method with the parameters that need to be changed.
Request
To update one or more specific attributes of one or more Variable(s) please make a PATCH request to the following URL:
HTTP Method | URL |
---|---|
PATCH | https://industrial.api.ubidots.com/api/v2.0/variables/_/bulk/update/ |
To update one or more specific attributes of one or more Variable(s) in a Device please make a PATCH request to the following URL:
HTTP Method | URL |
---|---|
PATCH | https://industrial.api.ubidots.com/api/v2.0/devices/<device_key>/variables/_/bulk/update |
Query Parameters
Parameter | Type | Use | Description |
---|---|---|---|
token | String | Authentication | Authentication Token can optionally be sent as a query parameter. |
Body Parameters
The body is an Array containing Variable JSON objects. Each Variable object can contain the following any of the following body parameters:
Parameter | Type | Required? | Description |
---|---|---|---|
label | String | No | The API label of Variable |
name | String | No | Name of the Variable |
description | String | No | Description of Variable |
tags | String Array | No | Variable tags |
properties | Object | No | Variable properties |
icon | String | No | Icon of Variable |
unit | String | No | Unit of Variable. Allowed values: raw (default) or synthetic |
syntheticExpression | String | No | Synthetic Expression of Variable |
Header
Parameter | Type | Description |
---|---|---|
X-Auth-Token | String | Authorization Token of account |
X-Bulk-Operation | Boolean | Need to be set to True for the bulk operation to work |
Content-Type | String (application/json) | Content type of body |
$ curl -X PATCH 'https://industrial.api.ubidots.com/api/v2.0/variables/_/bulk/update/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-H 'X-Bulk-Operation: True' \
-d '[
{
"id": "62e01b5eb5a1b0000e17148t",
"description": "New Description"
},
{
"id": "62e01b5eb5a1b0000e17148e",
"tags": ["Colombia","Medellin"]
},
{
"id": "62e01b5eb5a1b0000e17148b",
"unit": "km/H"
},
{
"id": "62e01b5eb5a1b0000e17148l",
"name": "New Name"
}
]'
{
"task": {
"id": "5e1794561a9ca5651e6b59ec"
}
}
{
"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.