API Errors

Every response from the Spoke Zone v2 API that has a 40x status code should contain an errors array containing information about each error that was triggered.

Example Error Response{ "errors": [ { "type": "invalid-field", "message": "\"oemId\" contains invalid value \"test\".", "details": { "field": "oemId" } }, { "type": "required-field", "message": "\"identifier\" is missing.", "details": { "field": "identifier" } } ] } Fields

Every backend error has three fields.

type

A string representing the type of error that occurred. Please see the list below for more specific details about each error type.

message

A human-readable string that can help clarify what needs fixed.

Never write code that depends on message. It change format at any time.

details

A JSON object containing additional context about the error.

The details field can change format at any time. If you write code that uses the value in details, be sure that it can gracefully handle situations where details has a new format.

Error Types

Indicates that a requested entity could not be found.

  • details.entityType - the type of entity that could not be found (in kebab-case)
    • Examples
      • data-file
      • device
      • model
  • details.entityId - the ID of the entity that could not be found

Indicates that the given access token is not authorized to complete the given operation.

  • details.field (optional) - the request field that triggered the error

Indicates that some limit in the API was exceeded, so the response could not be generated. This helps ensure that the API remains responsive.

Indicates that a required field was missing from the request.

  • details.field - the name of the field that was missing

Indicates that the request included a field with an invalid value.

  • details.field - the name of the field that contained an invalid value

Indicates that the request included an unknown field which the API did not know how to handle.

  • details.field - the name of the unknown field

Indicates that the request included invalid operations.

Indicates that some internal error occurred.

Indicates that the given endpoint is deprecated and its usage should be phased out soon.