Crear Device Type

Este endpoint crea un nuevo Device Type.

Solicitud HTTP

Para crear un nuevo Device Type, haz una petición POST a la siguiente URL:

HTTP MethodURL
POSThttps://api.netux.com/api/v2.0/device_types/

Parámetros de consulta

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter

Parámetros de cuerpo

ParameterTypeRequired?Default ValueDescription
labelStringYesN/A (required)API label of Device Type
nameStringNoslug(label)Name of Device Group
descriptionStringNo""Description of Device Group
deviceColorStringNo""Color of Device Type
deviceIconStringNo""Color of Device Type
variableColorStringNo""Color of Variables related to Device Type
syntheticVariableColorStringNo""Color of Synthetic Variables related to Device Type
variablesObject ArrayNo[]Variables related to Device Type
propertiesObject ArrayNo[]Properties of Device Type
tasksObject ArrayNo[]Tasks of Device Type

Cabecera

ParameterTypeDescription
X-Auth-TokenStringAuthentication Token of account
Content-TypeString (application/json)Content type of body
curl -X POST 'https://api.netux.com/api/v2.0/device_types/' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '{
    "name": "el type aquel",
    "label": "el-type-quel",
    "description": "La description aquella",
    "deviceColor": "#3BA9F5",
    "deviceIcon": "pencil",
    "variableColor": "#FFAE58",
    "syntheticVariableColor": "#",
    "variables": [
        {
            "properties": {
                "isLocationVariable": false,
                "hidden": false,
                "_color": "#FFAE58",
                "_icon": "cloud-upload"
            },
            "label": "var0",
            "name": "var0",
            "description": "",
            "tags": null,
            "type": 0,
            "unit": ""
        }
    ],
    "properties": [],
    "tasks": [
        {
            "id": "acbdee1d8472323763ff1b",
            "type": "dashboard",
            "name": "{{device.name}} Dashboard"
        }
    ]
}'

Respuesta

Devuelve un objeto Device Type con el Device Type creado.

{
    "url": "https://api.netux.com/api/v2.0/device_types/5e1f7e5789f9bd7c4e7f1e2c",
    "id": "5e1f7e5789f9bd7c4e7f1e2c",
    "name": "el type aquel",
    "label": "el-type-quel",
    "description": "La description aquella",
    "deviceColor": "#3BA9F5",
    "deviceIcon": "pencil",
    "variableColor": "#FFAE58",
    "syntheticVariableColor": "#",
    "variables": [
        {
            "properties": {
                "isLocationVariable": false,
                "hidden": false,
                "_color": "#FFAE58",
                "_icon": "cloud-upload"
            },
            "label": "var0",
            "name": "var0",
            "description": "",
            "tags": null,
            "type": 0,
            "unit": ""
        }
    ],
    "properties": [],
    "tasks": [
        {
            "id": "acbdee1d8472323763ff1b",
            "type": "dashboard",
            "name": "{{device.name}} Dashboard"
        }
    ],
    "createdAt": "2020-01-15T21:04:23.602975Z"
}
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        ....
    }
}
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}