Asignar Device a un Device Group

Este endpoint asigna uno o más Devices a un Device Group específico.

Solicitud HTTP

Para asignar uno o más Devices a un Device Group, haz una petición POST a la siguiente URL:

HTTP MethodURL
POSThttps://api.netux.com/api/v2.0/device_groups/<device_group_key>/_/assign_devices/

Parámetros de ruta

ParameterTypeDescription
device_group_keyStringThe id or label of the Device Group, label should use the prefix ~

Parámetros de consulta

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter.
clearBooleanAssigning ModusIf true all existing Devices will be replaced with the Devices sent in the request. If false Devices sent in the request will be appended.

Cabecera

ParameterRequired?Description
X-Auth-TokenYesAuthentication Token of account
$ curl -X POST 'https://api.netux.com/api/v2.0/device_groups/<device_group_key>/_/assign_devices/' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '[
  "5e1cc1e789f9bd33017e05f4",
  "~test",
  {"id": "5e1cc1e789f9bd33babababa"}
]'

Respuesta

Devuelve un objeto con un array results que contiene todos los Devices asignados al Device Group.

{
    "count": 2,
    "next": null,
    "previous": null,
    "results":[
        {
            "url": "https://api.netux.com/api/v2.0/devices/5e1cc1e789f9bd33017e05f4",
            "id": "5e1cc1e789f9bd33017e05f4",
            "label": "truck-v2",
            "name": "Truck v2"
        },
        {
            "url": "https://api.netux.com/api/v2.0/devices/5e1c8d9789f9bd33017e05e5",
            "id": "5e1c8d9789f9bd33017e05e5",
            "label": "test",
            "name": "test"
        },
        {
            "url": "https://api.netux.com/api/v2.0/devices/5e1c8d9789f9bd33017e05e5",
            "id": "5e1cc1e789f9bd33babababa",
            "label": "test2",
            "name": "test2"
        }
    ]
}
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        ....
    }
}
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}