Actualizar todos los campos de una Variable

Este endpoint actualiza todos los campos de la Variable especificada en el cuerpo.

📘

Actualizando un solo campo

Para actualizar sólo un campo de una Variable, utiliza el método PATCH con los parámetros que necesitan cambiarse.

Solicitud HTTP

Para actualizar todos los atributos de una Variable, haz una petición PUT a la siguiente URL:

HTTP Method

URL

PUT

https://api.netux.com/api/v2.0/variables/<variable_id>/

Para actualizar todos los atributos de una Variable en un Device, haz una petición PUT a la siguiente URL:

HTTP Method

URL

PUT

https://api.netux.com/api/v2.0/devices/<device_key>/variables/<variable_key>

Parámetros de ruta

Parameter

Type

Description

variable_id

String

The id of the Variable

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

ParameterTypeRequired?Default ValueDescription
labelStringYesN/A (required)The API label of Variable
nameStringNoSame as labelName of the Variable
descriptionStringNo""Description of Variable
tagsString ArrayNo[]Variable tags
propertiesObjectYesN/A (required)Variable properties
unitStringNo""Unit of Variable.
syntheticExpressionStringNo""Synthetic Expression of Variable

Cabecera

Parameter

Required?

Description

X-Auth-Token

Yes

Authentication Token of account

$ curl -X PUT 'https://api.netux.com/api/v2.0/variables/<variable_id>' \
 -H 'Content-Type: application/json' \
 -H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
 -d '{
    "label": "variable2",
    "name": "Variable 2",
    "description": "my variable 2",
    "tags": ["blue", "yellow"],
    "properties": {},
    "icon": "trash",
    "unit": "meters"
}'

Respuesta

Devuelve un objeto Variable con la Variable actualizada.

{
    "createdAt": "2019-12-18T14:38:38.354415Z",
    "syntheticExpression": "",
    "description": "my variable 2",
    "device": {
        "id": "6e309da44fc8455a9cceb5aa",
        "label": "first-device",
        "name": "First Device",
        "url": "https://api.netux.com/api/v2.0/devices/6e309da44fc8455a9cceb5aa"
    },
    "icon": "trash",
    "id": "5dfa39ee1a9ca53020c69391",
    "label": "variable2",
    "lastActivity": null,
    "lastValue": {},
    "name": "Variable 2",
    "properties": {},
    "tags": ["blue", "yellow"],
    "type": "raw",
    "unit": "meters",
    "url": "https://api.netux.com/api/v2.0/variables/5dfa39ee1a9ca53020c69391",
    "valuesUrl": "https://api.netux.com/api/v2.0/variables/5dfa39ee1a9ca53020c69391/values"
}
{
    "code": 400001,
    "message": "Validation Error.",
    "detail": {
        ....
    }
}
{
    "code": 401001,
    "message": "Authentication credentials were not provided.",
    "detail": "Authentication credentials were not provided."
}