All about Hotel-X Booking Query
The Booking Query operation enables you to obtain either the specific details of a reservation (booking details) or a list of reservations made within a specified time frame (booking list).
Booking details๐
What steps should I follow to retrieve the details of a booking?๐ก
To obtain the details of a specific reservation, you can use the Booking query by either "BookingID" (highly recommended) or by "references" (to be deprecated):
How can I perform a booking query while filtering by "bookingID"?๐ ๏ธ
Remember the bookingID is Hotel-X booking reference returned in Book response. Below, you'll find an example of a Booking Query that makes use of the "bookingID" filter:
Book response:
{
"data": {
"hotelX": {
"book": {
"booking": {
"reference": {
"client": "clientReferenceTest",
"supplier": "supplierReferenceTest",
"bookingID": "bookindIDTest"
},
"price": {
"currency": "EUR",
"net": 800,
"gross": 800,
"binding": false
},
"status": "OK",
},
"errors": null,
"warnings": null
}
}
}
}
Booking query request:
{
"criteriaBookingRead": {
"bookingID": "bookindIDTest"
},
"settings": {
"context": "contextCode",
"client": "clientCode",
"timeout": 58700,
"auditTransactions": false,
"testMode": false
}
}
How can I perform a Booking query while filtering by "references"?๐ ๏ธ
In order to perform a Booking query by "REFERENCES" (supplier and/or client references) you should add the references information in the CriteriaBookingReferencesInput:
{
"query" : "query ($criteriaBookingRead: HotelCriteriaBookingInput!, $settings: HotelSettingsInput!) {\n hotelX {\n booking(criteria: $criteriaBookingRead, settings: $settings) {\n auditData{\n\t\t\t\ttransactions{\n\t\t\t\t\trequest\n\t\t\t\t\trequest\n\t\t\t\t}\n\t\t\t\ttimeStamp\n\t\t\t}\n bookings {\n reference {\n client\n supplier\n bookingID\n }\n holder {\n name\n surname\n }\n hotel {\n creationDate\n checkIn\n checkOut\n hotelCode\n hotelName\n boardCode\n occupancies {\n id\n paxes {\n age\n }\n }\n rooms {\n occupancyRefId\n code\n description\n price {\n currency\n binding\n net\n gross\n exchange {\n currency\n rate\n }\n markups {\n channel\n currency\n binding\n net\n gross\n exchange {\n currency\n rate\n }\n }\n }\n }\n }\n price {\n currency\n binding\n net\n gross\n exchange {\n currency\n rate\n }\n markups {\n channel\n currency\n binding\n net\n gross\n exchange {\n currency\n rate\n }\n }\n }\n cancelPolicy {\n refundable\n cancelPenalties {\n hoursBefore\n penaltyType\n currency\n value\n }\n }\n remarks\n status\n payable\n }\n errors {\n code\n type\n description\n }\n warnings {\n code\n type\n description\n }\n }\n }\n}",
"variables" : {
"criteriaBookingRead" : {
"accessCode" : "",
"language" : "en",
"typeSearch" : "REFERENCES",
"bookingID" : "",
"references" : {
"hotelCode" : "",
"currency" : "",
"references" : [
{
"supplier" : "supplierReference",
"client" : "clientReference"
}
]
}
},
"settings" : {
"client" : "",
"auditTransactions" : true,
"context" : "",
"testMode" : false
}
}
}
Booking List๐
How can I retrieve a list of all bookings made within a specific time frame?๐ก
In order to obtain a list of all the reservations made within a specific type frame you should perform the Booking query by "typeSearch" "DATES", specify if your "dateType" is either "BOOKING" (booking date) or "ARRIVAL" (check-in date) and the "start" and "end" dates of the query (yyyy-MM-dd).
How can I perform a booking query while filtering by "DATES"?๐ ๏ธ
Below, you'll find an example of a Booking Query that makes use of the "DATES" filter:
{
"query" : "query ($criteriaBookingRead: HotelCriteriaBookingInput!, $settings: HotelSettingsInput!) {\n hotelX {\n booking(criteria: $criteriaBookingRead, settings: $settings) {\n auditData {\n transactions {\n request\n response\n }\n }\n bookings {\n reference {\n client\n supplier\n }\n holder {\n name\n surname\n }\n hotel {\n creationDate\n checkIn\n checkOut\n hotelCode\n hotelName\n boardCode\n occupancies {\n id\n paxes {\n age\n }\n }\n rooms {\n occupancyRefId\n code\n description\n price {\n currency\n binding\n net\n gross\n exchange {\n currency\n rate\n }\n markups {\n channel\n currency\n binding\n net\n gross\n exchange {\n currency\n rate\n }\n }\n }\n }\n }\n price {\n currency\n binding\n net\n gross\n exchange {\n currency\n rate\n }\n markups {\n channel\n currency\n binding\n net\n gross\n exchange {\n currency\n rate\n }\n }\n }\n cancelPolicy {\n refundable\n cancelPenalties {\n hoursBefore\n penaltyType\n currency\n value\n }\n }\n remarks\n status\n payable\n }\n errors {\n code\n type\n description\n }\n warnings {\n code\n type\n description\n }\n }\n }\n}",
"variables" : {
"criteriaBookingRead" : {
"accessCode" : "",
"language" : "en",
"dates" : {
"dateType" : "BOOKING",
"start" : "2020-10-17",
"end" : "2020-10-18"
},
"typeSearch" : "DATES"
},
"settings" : {
"client" : "",
"context" : "",
"auditTransactions" : true
}
}
}
What can I expect to receive in the Booking Query response?โ๏ธ
Some of the fields returned are:
- Holder
- Hotel
- Price
- Remarks
- Status
How can I find out if a Seller only accepts a specific type of Booking Query?โ
{
hotelX {
metadata(criteria: {supplierCodes: ["supplierCode"]}, relay: {}) {
adviseMessage {
code
level
description
}
edges {
node {
metadataData {
supplierCode
booking {
queryableBySupplierReference {
reviewDate
value
}
queryableByClientReference {
reviewDate
value
}
requiresCheckInDateInReferencesSearchType {
reviewDate
value
}
requiresCheckOutDateInReferencesSearchType {
reviewDate
value
}
requiresCheckInDateInReferencesSearchType {
reviewDate
value
}
}
}
}
}
}
}
}
Metadata Query response:
{
"data": {
"hotelX": {
"metadata": {
"adviseMessage": null,
"edges": [
{
"node": {
"metadataData": {
"supplierCode": "supplierCode",
"booking": {
"queryableBySupplierReference": {
"reviewDate": "2018-12-27",
"value": true
},
"queryableByClientReference": {
"reviewDate": "2018-12-27",
"value": true
},
"requiresCheckInDateInReferences": {
"reviewDate": "2021-10-11",
"value": false
},
"requiresCheckOutDateInReferences": {
"reviewDate": "2021-10-11",
"value": false
},
"requiresReservationDateInReferences": {
"reviewDate": "2021-10-11",
"value": false
}
}
}
}
}
]
}
}
}
}
- "queryableBy" indicates that the Seller allows searching through a given field.
- "requires" indicates whether receiving this information is mandatory on the Seller's API.
- "value" indicates if that Seller requires or allows that specific field.
- "reviewDate" indicates the last time this value was checked against the Seller.
If you are not using Hotel-X bookingID input, you should indicate your accessCode in the HotelCriteriaBookingInput. Language is optional, but we recommend adding this information for optimal results.
Don't forget to check our Documentation and API Schema for further information!๐