Account API – Format

The json-api specification will be used for all communication to and from the account API, with the exception of uploading and downloading files, which use typical Send-File HTTP messages.

DeviceHQ will support a slightly relaxed standard of json-api for client requests, with the following deviations from strict json-api:

  • It will not be necessary for requests targeting the API to have the Content-Type fields set to “application/vnd.api+json”. Clients may use this header, or set their Content-Type to “application/json”.
  • Clients may use either PUT or PATCH requests for updating resources. Json-api requires the use of PATCH only for updates, but since this may not be possible for all clients, either PUT or PATCH will be accepted.

All responses from the server will be json-api 1.0 compliant.

Example:

PUT /api/v2/devices/12345678 HTTP/1.1

Content-Type: application/vnd.api+json

Accept: application/vnd.api+json

{
  "data": {
    "type": "devices",
    "id": "12345678",
    "attributes": {
      "description": "Test device"
    }
  }
}