Provisionar Device

Este endpoint crea un Device con una o más Variables.

Solicitud HTTP

Para provisionar un Device incluyendo Variables, haz una petición POST a la siguiente URL:

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

Parámetros de consulta

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter

Parámetros de cuerpo

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

Cabecera

ParameterRequired?Description
X-Auth-TokenYesAuthentication Token of account
$ curl -X POST 'https://api.netux.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"
      }
   ]
}'

Respuesta

Devuelve un objeto que contiene un objeto Device del Device creado, junto con un Array con todas las Variables creadas.

{
    "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."
}