Errors
Error formats
Anagram uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx
range indicate success. Codes in the 4xx
range indicate an error that failed given the information provided (e.g., a required parameter was omitted). Codes in the 5xx
range indicate an error with Anagram’s servers (these are rare).
There are 2 possible error responses:
- Validation error with
Error
object, - General error with the string field
detail
.
General error (string field “detail”)
The error is related to the request itself. The field detail
contains a human-readable error message.
Example:
Validation error (error object in field “errors”)
Errors related to the request body object itself are validation errors with a status code 400 BAD_REQUEST
.
Validation errors return a response object with a field errors
, organized in a structure matching the request object (similar to GraphQL), containing error messages related to specific fields. For errors related to specific array elements, array indices are used as object keys.
Examples:
One error in the field quantity
of the first service object in the services
array field:
Three errors in the field last_name
of object primary_member
:
Validation errors in multiple fields: