Este endpoint crea múltiples Devices nuevos.
Solicitud HTTP
Para crear múltiples Devices nuevos, haz una petición POST a la siguiente URL:
HTTP Method | URL |
---|---|
POST | https://api.netux.com/api/v2.0/devices/_/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 Device. Cada objeto Device puede contener los siguientes parámetros de cuerpo:
Parameter | Type | Required? | Default Value | Description |
---|---|---|---|---|
label | String | Yes | N/A (required) | API label of Device |
name | String | No | Same as label | Name of Device |
description | String | No | "" | Description of Device |
tags | String Array | No | [ ] | Device tags |
properties | Object | No | { } | Device properties. Allowed attributes: _icon , _color , _location_type ,_location_variable (label of Variable) _location_fixed , _config |
organization | String | No | null | Organization of Device |
Cabecera
No olvidar
Ten en cuenta que el atributo de cabecera
X-Bulk-Operation
es necesario.
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/devices/_/bulk/create/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-H 'X-Bulk-Operation: True' \
-d '[
{
"label": "device_1",
"properties": {
"_location_type":"manual",
"_location_fixed": {
"lat": 6.2486,
"lng": 75.5742
}
}
},
{
"label": "device_2",
"tags": ["Colombia", "Medellin", "IoTIsGreat"]
},
{
"label": "device_3",
"properties": {},
"description":"This is the description for device_3"
}
]'
Respuesta
Devuelve un Task Id del proceso asíncrono.
{
"task": {
"id": "5f208f564763e74744b2ba87"
}
}
{
"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."
}