Provision Device

This endpoint creates a Device with one or more variables.

Request

To provision a Device including Variables please make a POST request to the following URL:

HTTP MethodURL
POSThttps://industrial.api.ubidots.com/api/v2.0/devices/_/provision/

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter.

Body Parameters

ParameterTypeRequired?Default ValueDescription
deviceObjectYesN/A (required)Same parameters as the body parameters of Create Device
variablesObject ArrayNo[]Variables created with Device

Header

ParameterRequired?Description
X-Auth-TokenYes[Authentication Token] (/reference/authentication) of account
$ curl -X POST 'https://industrial.api.ubidots.com/api/v2.0/devices/_/provision/' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '{
   "device":{
      "label":"first-device",
      "name":"First Device",
      "description":"other description",
      "isActive":true,
      "organization":null,
      "tags":["first"],
      "properties":{}
   },
   "variables":[
      {
         "label":"temperature",
         "name":"Temperature"
      },
      {
         "label":"brightness",
         "name":"Brightness"
      }
   ]
}'
{
    "device": {
        "id": "111115991d84726b6dbf4c3f",
        "label": "truck-v2",
        "name": "Truck v2",
        "_status": "created"
    },
    "variables": [
        {
            "id": "22222991d84726b6dbf4c40",
            "label": "temperature",
            "name": "Temperature",
            "_status": "created"
        },
        {
            "id": "222225991d84726b6dbf4c40",
            "label": "temperature",
            "name": "Temperature",
            "_status": "updated"
        },
        {
            "id": "3333359a1d84726b6dbf4c41",
            "label": "temperature_kelvin",
            "name": "temperature_kelvin",
            "_status": "created"
        },
        {
            "id": "",
            "label": "♪humidity",
            "_status": "error",
            "_message": "Validation Error",
            "_detail": {
                "label": [
                    "Enter a valid value."
                ],
                "syntheticExpression": [
                    "Invalid expression"
                ]
            }
        },
        {
            "id": "4444459a1d84726b6dbf4c42",
            "label": "brightness",
            "name": "Brightness",
            "_status": "created"
        }
    ]
}
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        ....
    }
}
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}

Response

Returns an object containing a Device object of the Device created together with an array with all variables created.