Guidelines for detecting and handling errors

The simplest way to detect and handle an error is by inspecting the HTTP Response Status Code of each request. Additional and more detailed error informations are usually returned in the response body.

Common HTTP Response Codes

HTTP Response Status Code is 200 on all successful responses. Other possible status codes are described on the table below. Additional status codes depend on the method.

STATUS CODE CONDITION
200 Successful request.
403 Invalid HTTP Method, Invalid Credentials, Unencrypted connection, etc.
404 Not Found ( e.g. invalid property or room code )
503 Unknown error or temporary unavailability
500 All other invalid requests or responses. Described by error_code

Response Bodies

A sample error response can be seen below. The nature of the error encountered is described by error_code and error_msg in human-readable format, while http_code will always reflect the HTTP Response Status Code.

{
	params: []
	http_code: 404
	error_msg: "Property not found."
	error_code: "NOT_FOUND"
	http_method: "GET"
	method: http://rest.reserve-online.net/property/nonexisting
}

Common Error Codes

ERROR_CODE HTTP_CODE DESCRIPTION
OK 200 The request completed successfully.
INTERNAL_ERROR 500 Internal service error. This is usually a bug in our code and we will be notified immediately.
FORBIDDEN 403 The credentials are invalid.
INVALID_RESPONSE_TYPE 403 The response type is not supported ( e.g. when requesting json when only xml is supported ).
INVALID_METHOD 403 Method requested is not supported ( e.g. POST is not supported, use GET ).
NO_AUTH 403 No authentication header found.
INVALID_AUTH 403 Invalid username or password.
INVALID_PARAM 500 When missing or invalid request parameters are passed. Check the error_msg for details.
GEO_INVALID_REQUEST 500 The location parameter is invalid ( returned by our Geocoding provider ).
GEO_OVER_QUOTA 500 You cannot make any more location queries ( returned by our Geocoding provider ).
GEO_NO_RESULTS 500 Location not found ( returned by our Geocoding provider ).
NO_HOTELS_FOUND 500 No properties found in specified location.