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 Method

URL

POST

https://industrial.api.ubidots.com/api/v2.0/devices/_/provision/

Query Parameters

Parameter

Type

Use

Description

token

String

Authentication

Authentication Token can optionally be sent as a query parameter.

Body Parameters

Parameter

Type

Required?

Default Value

Description

device

Object

Yes

N/A (required)

Same parameters as the body parameters of Create Device

variables

Object Array

No

[]

Variables created with Device

Header

Parameter

Required?

Description

X-Auth-Token

Yes

Authentication Token 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.