Error handling
The Lodging Partner GraphQL API responses can contain errors that occur during the different phases of a request (authentication, validation, schema generation, and execution) as well as internal system errors. The following describes the payload of an HTTP GraphQL response:
1{2 data: { ... },3 errors: [] // only present if an error occurs4}
The semantics of the response format as well as more details about the error object content (returned in the errors
array) are described in full detail in the GraphQL error spec.
HTTP status codes
These status codes are used in response to the HTTP request:
Code | Description |
---|---|
200 | HTTP request was successful. However, GraphQL execution errors are reported using this status code. The response will include a JSON response payload that follows the error format described below. |
400 | Server cannot process the request because of an issue with the request. The response will include a JSON response payload that follows the error format described below. |
401 | Unauthorized. The API cannot fulfill the request because the client does not have the necessary scopes to access the capability or because the access token is missing, invalid, or expired. Response does not contain a response body. |
403 | Forbidden. The server refuses to authorize it because the partner does not have the necessary scopes to call the specific capability, is not allowed to access a specific resource (permission check error), or is not allowed to upload/download the files. The response will include a JSON response payload that follows the error format described below. |
404 | Not found. The requested file could not be found. The response will include a JSON response payload that indicates the file ID. |
429 | User has sent too many requests in a given amount of time ("rate limiting"). Response does not contain a response body. |
500 | An internal error occurred. Response may contain a JSON response payload depending on the type of error or where it originates in the application stack. |
Error classes
If an error is thrown before or during the following, it is associated with the GraphQL request:
- transport of the HTTP request to the server hosting the GraphQL endpoint
- the request phase of the GraphQL lifecycle
- the parse phase of the GraphQL lifecycle
- the validate phase of the GraphQL lifecycle
If an error is during the execute phase of the GraphQL lifecycle, it is associated with the GraphQL execution.
In either case, an error object is returned to the requester. An HTTP or GraphQL request error results in a non-200 status code, while a GraphQL execution error results in a 200 status code. These error classes are defined as follows:
User input error during GraphQL execution
This occurs when an input or parameter to a resolver was not in an expected form or did meet parameter requirements. The intention of this type of error is to give the user information about what to change or provide. For the reservation update feature, user input messages include the following:
Message Recommended action to correct the error The given reservation ID does not exist for this property. Ensure you are reconciling the reservation using the correct reservation ID. Only Hotel Collect reservations can be cancelled or reconciled. This functionality is currently available for Hotel Collect reservations only. Also, ensure you are reconciling the reservation using the correct reservation ID. Reservations with check-in dates in the future cannot be reconciled. This functionality is available for reservations with check-in dates of today or in the past only. Also, ensure you are reconciling the reservation using the correct reservation ID. Reservation cannot be reconciled because reconciliations must be submitted by the 4th of the month following the reservation’s checkout date. This functionality is not available for reservations with checkout dates before the first of the current month and the current date is past the fourth of the month. Also, ensure you are reconciling the reservation using the correct reservation ID. Cancellation fee or no-show fee cannot be greater than the initial booking amount. Specify a cancellation penalty that is less than or equal to the original booking amount. Cancellation fee or no-show fee cannot be a negative value. Specify a non-negative penalty amount value. Invalid currency specified. [currency code] is supported for this reservation. Ensure that the penalty amount’s currency code matches that of the original reservation. Only Hotel Collect reservations can be updated and reconciled for the post-stay scenario. This functionality is currently available for Hotel Collect reservations only. Also, ensure you are reconciling the reservation using the correct reservation ID. Reservation cannot be reconciled because one or more of the amounts specified in rateItems is too high compared to the original amount for that day. Specify a reconciled amount that is less than four times the original daily base rate. Reservation cannot be reconciled as too much time has elapsed since checkout. Reconciliations are possible from the date of check-in to the fourth of the month after checkout. The travel dates of the reservation you are attempting to reconcile are before the current month and therefore cannot be reconciled. Also, ensure you are reconciling the reservation using the correct reservation ID. Only reservations with check-in dates of today or in the past can be updated. Future reservations cannot be updated. Also, ensure you are reconciling the reservation using the correct reservation ID. Daily rateItem amounts cannot have negative values. Specify a non-negative value for the reconciled amount. Dates in rate objects cannot overlap. Make sure the date ranges specified do not overlap. A stay date must be specified for each reconciliation amount. Make sure the stay date is specified for every reconciliation amount. Specified currency must match the currency supported for this property. Make sure the reconciled amount currency codes match that of the original reservation. Reservation cannot be reconciled because the updated checkout date is before the reservation check-in date. Make sure the updated checkOutDate is after the reservation checkInDate. Specified stay dates do not match the updated check-in or checkout dates. Make sure the stay date ranges match the check-in and checkOut date window. [invalid reason] is not a supported value for 'reason'. Supported values are NO_SHOW and GUEST_REQUESTED_CANCEL. Specify either NO_SHOW and GUEST_REQUESTED_CANCEL as the reason. Only PER_DAY is allowed in rateTimeUnit Specify PER_DAY for rateTimeUnit. Properties that are enabled for group reconciliation cannot be reconciled. This functionality is not available for reservations on properties that use group reconciliation. Also, ensure you are reconciling the reservation using the correct reservation ID. currencyCode must be an alphabetical string of length 3. Make sure the currency code includes only three letters. This booking has been reconciled for the maximum allowed limit. Only three reconciliations are allowed. VRBO is not allowed in propertyIdSource. The VRBO enumeration value is not supported; only EXPEDIA is supported for propertyIdSource. A maximum of three days can be added before and after the original booking. Up to three days can be added before the original check-in date or up to three days after the original checkout date. This booking cannot be reconciled more than once due to Strong Customer Authentication regulations. Only one reconciliation can be performed on this property, which resides in a region governed by Strong Customer Authentication regulations. An HTTP status code of 200 is returned. Here is an example of the error object response format:
1{2 "message": "pageSize is limited to a maximum of 25",3 "locations": [],4 "path": [5 "reservationsByPropertyId"6 ],7 "extensions": {8 "code": "BAD_USER_INPUT"9 }10}
Data source does not exist
This type of error occurs when you are trying to access a resource that doesn't exist, such as if a property doesn't exist in our systems yet. An HTTP status code of 200 is returned. Here is an example of the error object response format:
1{2 "message": "id: PMSC/PM/396240 not found.",3 "locations": [4 {5 "line": 2,6 "column": 37 }8 ],9 "path": [10 "property"11 ],12 "extensions": {13 "code": "DATA_SOURCE_ERROR"14 }15}
Authentication error during GraphQL execution
This occurs when the requesting client needs to be authenticated in order to access the requested data. An HTTP status code of 200 is returned. Here is an example of the error object response format:
1{2 "message": "This content requires authentication",3 "locations": [4 {5 "line": 2,6 "column": 37 }8 ],10 "extensions": {11 "code": "UNAUTHENTICATED",12 }13}
Forbidden error during GraphQL execution
This type of error occurs when the requesting client is not permitted to access the requested resource or GraphQL data path. An HTTP status code of 403 is returned. Forbidden error messages include the following:
Insufficient Permissions
Missing Required Scope
Here is an example of the error object response format:
1{2 "errors": [3 {4 "message": "Insufficient Permissions on field=promotions for args={\"pageSize\":10,\"filter\":{\"status\":\"ACTIVE\"}}",5 "path": [6 "...",7 "promotions"8 ],9 "extensions": {10 "code": "FORBIDDEN"11 }12 }13 ],14 "data": {15 "property": null16 },17 "extensions": {18 "trace": {19 "Trace-ID": "d3d843da-92a8-4e5b-80dc-f13dd5c9d89d"20 }21 }
Syntax errors in the GraphQL request
These occur when the GraphQL operation payload in the GraphQL request is malformed. An HTTP status code of 400 is returned. Here is an example of the error object response format:
1{2 "message": "Syntax Error: Unexpected Name \"qury\"",3 "locations": [4 {5 "line": 1,6 "column": 17 }8 ],9 "extensions": {10 "code": "GRAPHQL_PARSE_FAILED"11 }12}
Validation errors in the GraphQL request
This type of error occurs when a query is syntactically valid but does not adhere to the restrictions defined by the schema, such as if a required argument was not provided. An HTTP status code of 200 is returned. Here is an example of the error object response format:
1{2 "message": "Field \"property\" argument \"propertyId\" of type \"ID!\" is required, but it was not provided.",3 "locations": [4 {5 "line": 2,6 "column": 37 }8 ],9 "extensions": {10 "code": "GRAPHQL_VALIDATION_FAILED"11 }12}
Unknown resource
If a non-existent resource is requested, such as an advertiser or property that does not exist, an HTTP status code of 200 is returned but the data set is null. Here is an example of the response:
1{2 "message": "an unexpected error occurred",3 "locations": [4 {5 "line": 2,6 "column": 37 }8 ],9 "path": [10 "property"11 ],12 "extensions": {13 "code": "INTERNAL_SERVER_ERROR"14 }15}
Internal server error during GraphQL execution
This type of error occurs when an error object is thrown from a resolver, when an error could not automatically be remapped to a known error class, or when an internal server error is thrown from a resolver. An HTTP status code of 200 is returned. Here is an example of the error object response format:
1{2 "message": "<message provided to error class constructor>",3 "locations": [4 {5 "line": 2,6 "column": 37 }8 ],10 "extensions": {11 "code": "INTERNAL_SERVER_ERROR"12 }13}