Example – Update a Device

Although a large amount of information is available when reading a device through the API, a very limited set of items can be updated through it. This is because device updates are designed to be executed by the device directly when it checks in and updates on DeviceHQ.com.

Fields updateable through the API/v2 interface include “description,” “group,” and “location_description”. These can be viewed at devicehq.com, under the device/edit page for a given device. “Description” and “group” are simply arbitrary strings.

“location_description” should be an array of [latitude, longitude]

  • PUT /api/v2/devices/(serial or UUID)
    • Accepts updated information for the device and returns the device. Only fields changeable in DeviceHQ® can be changed in the API.

Example:

PUT /api/v2/devices/12345678
Content-Type: application/json
Accept: application/json

{
  "data": {
    "id": "12345678",
    "type": "devices",
    "attributes": {
      "description": "Device installed in building 33"
      "location_description": [44.211, -92.12],
      "group": "product test"
    }
  }
}