Account API – Format

The [json-api](http://jsonapi.org/format/) 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 supports a slightly relaxed standard of json-api for client requests, with the following deviations from strict json-api:

  • It is not be necessary for requests targeting the API to have the header Content-Type fields set to “application/vnd.api+json”. Clients may use this heade, 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"
    }
  }
}