Bulk Create Variables

This endpoint creates one or more new Variable(s) at once.

Request

To create multiple new Variables please make a POST request to the following URL:

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

To create multiple new Variables 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/create

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 body parameters:

ParameterTypeRequired?Default ValueDescription
labelStringYesN/A (required)API label of Variable
nameStringNoSame as labelName of Variable
descriptionStringNo""Description of Variable
device<device_key>YesN/A (required)Key of Device (id or label)
tagsString ArrayNo[]Variable tags
propertiesObjectNo{}Variable properties. Allowed attributes: _icon, _color, minimum_value, maximum_value, isLocationVariable, _position, _scale, _offset
typeStringNorawVariable type. Allowed values raw (default) and synthetic
unitStringNo""Variable unit
syntheticExpressionStringNo""Synthetic Expression of Variable

Header

ParameterTypeDescription
X-Auth-TokenStringAuthentication 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/create/' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -H 'X-Bulk-Operation: True' \
 -d '[
    {
        "label": "first-variable",
        "device": "~first-device"
    },
    {
        "label": "second-variable",
        "device": "~first-device"
    },
    {
        "label": "third-variable",
        "device": "~first-device"
    },
    {
        "label": "fourth-variable",
        "device": "~first-device"
    }
]'
{
    "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.