Para provisionar un Device incluyendo Variables, haz una petición POST a la siguiente URL:
HTTP Method | URL |
---|
POST | https://api.netux.com/api/v2.0/devices/_/provision/ |
Parameter | Type | Use | Description |
---|
token | String | Authentication | Authentication Token can optionally be sent as a query parameter |
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 |
$ 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"
}
]
}'
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."
}