Bulk Update Variables

This endpoint updates all Variable fields specified in the body for multiple Variables at once.

Request

To update all attributes of one or more Variable(s) please make a POST request to the following URL:

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

To update all attributes of one or more Variable(s) in a Device please make a POST request to the following URL:

HTTP MethodURL
POSThttps://industrial.api.ubidots.com/api/v2.0/devices/<device_key>/variables/_/bulk/update

🚧

It's a POST

Please note that it's a POST request and not a PUT request.

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication 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:

ParameterTypeRequired?Description
labelStringNoThe API label of Variable
nameStringNoName of the Variable
descriptionStringNoDescription of Variable
tagsString ArrayNoVariable tags
propertiesObjectNoVariable properties
iconStringNoIcon of Variable
unitStringNoUnit of Variable. Allowed values: raw (default) or synthetic
syntheticExpressionStringNoSynthetic Expression of Variable

Header

ParameterTypeDescription
X-Auth-TokenStringAuthorization Token of account
X-Bulk-OperationBooleanNeed to be set to True for the bulk operation to work
Content-TypeString (application/json)Content type of body
$ curl -X POST '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": "5dfa39ee1a9ca53020c69391",
        "label": "variable1",
        "name": "Variable 1",
        "description": "my variable 1",
        "tags": ["blue"],
        "properties": {},
        "icon": "trash",
        "unit": "meters"
    },
    ...
    {
        "id": "5dfa39ee1a9ca53020a894ed",
        "label": "variable3",
        "name": "Variable 3",
        "description": "my variable 3",
        "tags": ["yellow"],
        "properties": {},
        "icon": "trash",
        "unit": "meters"
    }
]'
{
    "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.