The Noonlight API uses conventional HTTP status codes to indicate success or failure. Responses with a status code starting with 4xx
or 5xx
can be considered as failed. The API returns errors in JSON format in following structure:
{
"code": 400,
"key": "invalid_payload",
"message": "Bad Request",
"details": "should have required property phone"
}
If retrying 5xx
errors, please use a error handling strategy such as exponential backoff.
Developer-friendly API
Noonlight attempts to provide a developer-friendly API, hence sometimes you can find a hint on how to fix an error right in its details (like in the example above).
Attributes | Description |
---|---|
code | The HTTP status code of error returned. Can be: 2xx , 4xx , or 5xx |
key | For API object errors, a machine-readable string describing the kind of error that occurred |
message | A human-readable message providing short description about the error |
details | A human-readable message providing more details about the error |
Some example key
values:
Key | Description |
---|---|
resource_not_found | Entity with provided id does not exist |
invalid_payload | A request body is invalid and cannot be processed |
alarm_canceled | The alarm has already been canceled and can no longer be modified |