Este endpoint crea una o más nuevas Variables al mismo tiempo.
Solicitud HTTP
Para crear múltiples Variables nuevas, haz una petición POST a la siguiente URL:
HTTP Method | URL |
---|---|
POST | https://api.netux.com/api/v2.0/variables/_/bulk/create/ |
Para crear múltiples Variables nuevas en un Device, haz una petición POST a la siguiente URL:
HTTP Method | URL |
---|---|
POST | https://api.netux.com/api/v2.0/devices/<device_key>/variables/_/bulk/create |
Parámetros de consulta
Parameter | Type | Use | Description |
---|---|---|---|
token | String | Authentication | Authentication Token can optionally be sent as a query parameter. |
Parámetros de cuerpo
El cuerpo es un array que contiene objetos JSON correspondientes a Variables. Cada objeto de Variable puede contener los siguientes parámetros de cuerpo:
Parameter | Type | Required? | Default Value | Description |
---|---|---|---|---|
label | String | Yes | N/A (required) | API label of Variable |
name | String | No | Same as label | Name of Variable |
description | String | No | "" | Description of Variable |
device | <device_key> | Yes | N/A (required) | Key of Device (id or label) |
tags | String Array | No | [] | Variable tags |
properties | Object | No | {} | Variable properties. Allowed attributes: _icon , _color , minimum_value , maximum_value , isLocationVariable , _position , _scale , _offset |
type | String | No | raw | Variable type. Allowed values raw (default) and synthetic |
unit | String | No | "" | Variable unit |
syntheticExpression | String | No | "" | Synthetic Expression of Variable |
Cabecera
Parameter | Required? | Description |
---|---|---|
X-Auth-Token | Yes | Authentication Token of account |
X-Bulk-Operation | Boolean | Need to be set to True for the bulk operation to work |
Content-Type | String (application/json) | Content type of body |
curl -X POST 'https://api.netux.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"
}
]'
Respuesta
Devuelve un Task Id del proceso asíncrono.
{
"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."
}