Error Handling
All successful calls are returned as a HTTP status code 200 OK.
Calls that were unsuccessful will have a HTTP status code in the 400 or 500 range.
Errors messages for these calls are returned in a machine-readable format based on https://tools.ietf.org/html/rfc7807 These errors are called ProblemDetails. Examples of this can be found below.
Common properties in a ProblemDetail response:
Property | Explanation |
---|---|
type | The type of the ProblemDetail, usually contains information about the provided HTTP status code |
title | The title contains a description about the kind of problem. |
status | The HTTP status code of the response. |
errors | The errors property contains detailed messages about the errors of the request. If the error is a validation error then there will be an error message for every property that is incorrect. |
detail | A detailed error message |
traceId | When you have a question about an error, it can be useful to provide the traceId so we can track the error on our end. |
Examples
Example of a request with it's product id missing
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-1ec9a9f2c8e57109ccf68a9d4ed718c0-66243b0905b40c6f-00",
"errors": {
"ProductId": ["'Product Id' must not be empty."]
}
}
Example of a request were the departure date is smaller than the arrival date
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-e7ac8bd7efc04a6b13326c41b3a6b532-d9cfdf3d62aad09d-00",
"errors": {
"DepartureDate": [
"'Departure Date' must be greater than '04/25/2023 00:00:00 +00:00'."
]
}
}
Example of a request were the article quantity must be greater than zero
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-0e467c19d07c190c23fc965b2a878614-5889b00c62e146d0-00",
"errors": {
"Articles[0].Quantity": [
"'Quantity' must be greater than '0'."
],
}
}
Example of a request when there is no unit available for the parameters in the request
{
"type": "https://httpstatuses.io/400",
"status": 400,
"detail": "There is no unit available that meets the request parameters",
"traceId": "00-5573c0022a25112a4e9cf7f8136a298b-4ec4f55e15b5f237-00"
}
Example of a request when the request is Unauthorized
{
"type": "https://httpstatuses.io/401",
"title": "Unauthorized",
"status": 401,
"traceId": "00-1c07ee17b27a688d3c46027551e48321-479cc9752b67aa70-00"
}
Common HTTP status codes
The list below contains most HTTP status codes that Booking can return.
Status code | Reason |
---|---|
200 | Ok - Your request was successful. |
400 | Bad request - The request might contain data that is not valid according to booking. Please check the 'errors' property of the return message to find out what is wrong. |
401 | Unauthorized - The request has failed to authenticate, please check if the API key is valid for the request you are making. |
403 | Forbidden - You do not have permission to access the requested resource. |
404 | Not found - The server cannot find the requested resource. |
405 | Method not allowed - The method used for the request is not allowed for the requested resource. |
415 | Unsupported Media Type - The format of the payload of the request is not recognized. |
429 | Too many requests - There are too many requests being sent to the server. |
500 | Internal server error - An internal server error occured while processing the request. |
502 | Bad Gateway - The service is temporarily unavailable, this might be due to an update, retry the request at a later time. |
503 | Service Unavailable - The service is temporarily unavailable, this might be due to an update, retry the request at a later time. |
504 | Gateway Timeout - It took too long to process the request. |