Update Device Fields

This endpoint updates the Device fields specified in the body.

👍

Update Location of Device

In order to add/update the location of the device simply add the _location_fixed object to the properties body parameter:

"properties": { "_location_type":"manual", "_location_fixed": { "lat": 6.2486, "lng": 75.5742 } }

Request

To update one or more specific attributes of a Device please make a PATCH request to the following URL:

HTTP MethodURL
PATCHhttps://industrial.api.ubidots.com/api/v2.0/devices/<device_key>/

Path Parameters

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

Query Parameters

ParameterTypeUseDescription
tokenStringAuthenticationAuthentication Token can optionally be sent as a query parameter.

Body Parameters

ParameterTypeRequired?Description
labelStringNoThe API label of Device
nameStringNoName of the Device
descriptionStringNoDescription of Device
tagsString ArrayNoDevice tags
propertiesObjectNoDevice properties
organization<organization_key>NoKey of Organization (id or label)

Header

ParameterRequired?Description
X-Auth-TokenYes[Authentication Token] (/reference/authentication) of account

📘

Properties Object

Please note that all attributes inside the properties attribute have an underscore _ as prefix.

$ curl -X PATCH 'https://industrial.api.ubidots.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"]
}'
{
    "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://industrial.ubidots.com/api/v2.0/organizations/af92e4c82bf1d39cc21882f5b"
    },
    "tags": ["first"],
    "url": "http://industrial.ubidots.com/api/v2.0/devices/6e309da44fc8455a9cceb5aa",
    "variables": "http://industrial.ubidots.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."
}

Response

Returns a Device object of the updated Device.