Este endpoint actualiza los campos de un Device especificados en el cuerpo.
Actualizar ubicación de Device
Para añadir/actualizar la ubicación del Device basta con añadir el objeto
_location_fixed
al parámetro de cuerpoproperties
:"properties": { "_location_type":"manual", "_location_fixed": { "lat": 6.2486, "lng": 75.5742 } }
Solicitud HTTP
Para actualizar uno o más atributos específicos de un Device, haz una petición PATCH a la siguiente URL:
HTTP Method | URL |
---|---|
PATCH | https://api.netux.com/api/v2.0/devices/<device_key>/ |
Parámetros de ruta
Parameter | Type | Description |
---|---|---|
device_key | String | The id or label of the Device, label should use the prefix ~ |
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
Parameter | Type | Required? | Description |
---|---|---|---|
label | String | No | The API label of Device |
name | String | No | Name of the Device |
description | String | No | Description of Device |
tags | String Array | No | Device tags |
properties | Object | No | Device properties |
organization | <organization_key> | No | Key of Organization (id or label) |
Cabecera
Parameter | Required? | Description |
---|---|---|
X-Auth-Token | Yes | Authentication Token of account |
Objeto
properties
Ten en cuenta que todos los atributos dentro del atributo
properties
tienen un guión bajo_
como prefijo.
$ curl -X PATCH 'https://api.netux.com/api/v2.0/devices/<device_key>/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"properties": {
"_location_fixed": {
"lat": 6.2486,
"lng": 75.5742
}
},
"description": "My first Device",
"label": "first-device",
"name": "First Device",
"organization": "af92e4c82bf1d39cc21882f5b",
"tags": ["first"]
}'
Respuesta
Devuelve un objeto Device del Device actualizado.
{
"properties": {
"_location_fixed": {
"lat": 6.2486,
"lng": 75.5742
}
},
"createdAt": "2019-11-25T19:35:08.975270Z",
"description": "change description",
"id": "6e309da44fc8455a9cceb5aa",
"isActive": true,
"label": "first-device",
"lastActivity": null,
"name": "First Device",
"organization": {
"id": "af92e4c82bf1d39cc21882f5b",
"label": "my-first-customer",
"name": "My First Customer",
"url": "http://api.netux.com/api/v2.0/organizations/af92e4c82bf1d39cc21882f5b"
},
"tags": ["first"],
"url": "http://api.netux.com/api/v2.0/devices/6e309da44fc8455a9cceb5aa",
"variables": "http://api.netux.com/api/v2.0/devices/6e309da44fc8455a9cceb5aa/variables",
"variablesNumber": 1
}
{
"code": 400001,
"message": "Validation Error.",
"detail": {
....
}
}
{
"code": 401001,
"message": "Authentication credentials were not provided.",
"detail": "Authentication credentials were not provided."
}