Error Handling¶
This page explains the common API errors. Note that the error messages given in this page are the generic error message and could vary depending on the request.
Error Response Structure¶
When an error occurs the API returns an error response with the following payload fields:
- code: The http status code.
- title: The error title.
- message: A message describing the error.
- key: The error type key.
- public: Is the error public (safe to show to the user?)
- error_id: An unique id for the error that can be traced to get more detail about the error.
Bad Request (400)¶
Cause: The request sent by the client is invalid.
Action: Review and fix the request parameters.
Payload:
- code: 400
- title: Bad Request
- message: The request can’t be processed
- key: bad_request
- public: True
Authentication failed (401)¶
Cause: Authentication failed and the request is unauthorized.
Action: Authenticate with the correct credentials.
Payload:
- code: 401
- title: Unauthorized
- message: Authentication failed
- key: unauthorized
- public: True
Access Forbidden (403)¶
Cause: Access Forbidden. The user making the request has no permission to access the resource.
Action: Verify that the user making the request has permission to access the following resource.
Payload:
- code: 403
- title: Forbidden
- message: Permission denied
- key: forbidden
- public: True
Invalid Credit Card (403)¶
Cause: Credit card is invalid
Action: Verify the credit card information and that the credit card is valid.
Payload:
- code: 403
- title: Credit card validation error
- message: Failed to validate credit card
- key: credit_card_check
- public: True
Not Found (404)¶
Cause: The resource was not found, either the endpoint path is wrong or it’s trying to access a resource that is not found in the database.
Action: Verify the endpoint path or verify the parameters for the resource you are trying to access
Payload:
- code: 404
- title: Not found
- message: Resource not found
- key: not_found
- public: True
Method not allowed (405)¶
Cause: The endpoint do not support the given Method (GET, POST, PUT, ...).
Action: Verify the endpoint method
Payload:
- code: 405
- title: Method not Allowed
- message: A request was made of a resource using a request method not supported by that resource
- key: not_allowed
- public: True
Not Acceptable (406)¶
Cause: The content type is not supported. In most cases the content type must be application/json.
Action: Verify the request content type header and payload.
Payload:
- code: 406
- title: Not acceptable
- message: Content-Type must be application/json
- key: not_acceptable
- public: True
Request Timeout (408)¶
Cause: The request timed out because it took too much time to respond.
Action: Try later or contact Ormuco.
Payload:
- code: 408
- title: Request Timeout
- message: The server timed out waiting for the request
- key: request_timeout
- public: True
Conflict (409)¶
Cause: The parameters sent conflicts with the target resource state or configuration.
Action: Check the request parameters and the current state of the target resource and make sure the parameters do not conflict with the current resource state that you are trying to update.
- code: 409
- title: Conflict
- message: The request could not be completed due to a conflict with the current state of the target resource
- key: conflict
- public: True
Payload Too Large (413)¶
Cause: The request payload is too large.
Action: Check the request payload and if possible try to reduce the payload size.
Payload:
- code: 413
- title: Conflict
- message: The request payload is larger than the server is willing or able to process
- key: payload_too_large
- public: True
Too Many Requests (429)¶
Cause: The user has sent too many requests in a given amount of time.
Action: If the user is making too many request in a short amount of time, try to reduce the number of requests or contact Ormuco if you suspect any unusual activity.
Payload:
- code: 429
- title: Conflict
- message: The user has sent too many requests in a given amount of time.
- key: too_many_requests
- public: True
Token Required (499)¶
Cause: A token is required and was not provided.
Action: Make sure to send the required token.
Payload:
- code: 499
- title: TokenRequired
- message: Token Required
- key: token_required
- public: True
Server Error (500)¶
Cause: An internal server error has occurred.
Action: Contact Ormuco with the given error_id.
Payload:
- code: 500
- title: Internal Server Error
- message: Something wrong happened...
- key: server_error
- public: False
Multiple Results Found (500)¶
Cause: A single database result was required but more than one were found.
Action: Verify the parameters or contact Ormuco with the given error_id.
Payload:
- code: 500
- title: Multiple results found
- message: A single database result was required but more than one were found
- key: sql_multiple_results_found
- public: False
Default Value Missing (500)¶
Cause: Missing default value when querying object.
Action: Verify the parameters or contact Ormuco with the given error_id if the error persists.
Payload:
- code: 500
- title: Default Value Missing
- message: Missing default value when querying object.
- key: missing_defaul_value
- public: True
Bad Gateway (502)¶
Cause: A single database result was required but more than one were found.
Action: Contact Ormuco with the given error_id if the error persists.
Payload:
- code: 502
- title: Bad Gateway
- message: The server was acting as a gateway or proxy and received an invalid response from the upstream server
- key: bad_gateway
- public: True
Gateway Timeout (503)¶
Cause: The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
Action: Try later or contact Ormuco with the given error_id if the error persists.
Payload:
- code: 503
- title: Service Unavailable
- message: The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
- key: gateway_timeout
- public: True