Account API – Route

All account API access will be done with routes starting with:

/api/v2

For example, to display information for a single device, the https request

GET https://devicehq.com/api/v2/devices/12341234

would yield a json-formatted string containing device information for a device with a serial # of 12341234

Devices may be specified by their UUID or their serial #.

Note:

  • The UUID must contain exactly 32 hexadecimal characters.
  • Any whitespace or non-alphanumeric characters will be stripped.
  • It is not case sensitive.

The following routes are available in the API:

  • GET /api/v2/info
    • Returns basic info about the API. Authentication not required. Useful for testing if API/v2 is successfully reached, and is up and running.
  • GET /api/v2/test
    • Session and authentication required. Useful for testing if the client is establishing a session and reaching the API. Returns “OK” and timestamp if successfully reached.
  • GET /api/v2/account
    • Returns account information for the present account.
  • GET /api/v2/account/users
    • Returns list of users for the present account.
  • GET /api/v2/devices
    • Returns list of devices. Supports search and pagination (see Account API – Search and Pagination for more information).
  • GET /api/v2/devices/(serial or UUID)
    • Returns single device identified by serial# or uuid. Will include all fields that are presently visible when the user clicks on a device in DeviceHQ.com.
  • GET /api/v2/devices/(serial or UUID)/check_ins
    • Returns all check-ins for a device going back 30 days.
  • GET /api/v2/devices/(serial or UUID)/signal_strength
    • Returns reported signal strength information for a device going back 30 days.
  • GET /api/v2/devices/(serial or UUID)/network
    • Returns network usage for a device going back 30 days.
  • GET /api/v2/devices/(serial or UUID)/lora
    • Returns LoRa card information for a device going back 30 days.
  • GET /api/v2/devices/(serial or UUID)/logs
    • Returns last uploaded (tar/zip formatted) device logs.
  • GET /api/v2/devices/(serial or uuid)/configs
    • Returns last uploaded (tar/zip formatted) configuration for the device.
  • PUT /api/v2/devices/(serial or uuid)
    • Accepts updated information and returns for the device. Only fields changeable in DeviceHQ can be changed in the API.
  • POST /api/v2/devices/register {serial: 12345678, UUID:”776334cb-8e42-4839-835c-899d075d63ae”}
    • Registers a device with the current account, allowing the “call-home” feature to work.
  • DELETE /api/v2/devices/(serial or UUID)
    • Removes a device and all associated records from the database of DeviceHQ. If the device subsequently checks in, it will be recreated in the same account.