📘 To update only a single field of a Device, please use the PATCH method with the parameters that need to be changed.
To update all fields of a Device please make a PUT request to the following URL:
HTTP Method URL PUT https://industrial.api.ubidots.com/api/v2.0/devices/<device_key>/
Parameter Type Description device_key String The ID or label of the Device, label should use the prefix ~
Parameter Type Use Description token String Authentication Authentication Token can optionally be sent as a query parameter.
Parameters Type Required? Default Value Description label String Yes N/A (required) The API label of Device name String No Same as label Name of Device description String No ""Description of Device tags String Array No []Device tags properties Object No {}Device properties organization <organization_key> No nullKey of Organization (ID or label)
cURL (Request)
$ curl -X PUT 'https://industrial.api.ubidots.com/api/v2.0/devices/<device_key>/' \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: oaXBo6ODhIjPsusNRPUGIK4d72bc73' \
-d '{
"properties": {},
"description": "change description",
"isActive": true,
"label": "first-device",
"name": "First Device",
"organization": "af92e4c82bf1d39cc21882f5b",
"tags": ["first"],
}'
200 OK 400 Bad Request 401 Unauthorized
{
"properties": {},
"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"
},
"position": {
"lat": 6.2486,
"lng": 75.5742
},
"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."
}
Returns a Device object of the updated Device.