Quickstart
Introduction
Hotel-X API is a powerful aggregation solution that allows you to get results from the largest network of Sellers in a single request. Whether it's at the hotel, room type, or rate plan level, you have the flexibility to aggregate data to meet your specific needs.
What sets Hotel-X API apart is its innovative plugin structure, which enhances connectivity and equips you with a competitive edge in your operations. This unique feature is complemented by Hotel-X's ability to provide pre-processed responses, ensuring your system tasks are efficient and hassle-free.
Using the Hotel-X API, you will be able to access static information, make bookings, and manage reservations. In this quickstart tutorial, you will learn how to create a simple sample booking.
Let's Get Started: How to Make a Booking!
Hotel-X offers a powerful GraphQL-based API that simplifies the process of booking hotels and managing reservations. Whether you're a seasoned developer or just getting started, this guide will walk you through the basics of using the API to make hotel bookings.
Prerequisites
Endpoint
Hotel-X, being a GraphQL-based API, utilizes a single endpoint for all operations:
https://api.travelgatex.com
Or https://api-cn.travelgatex.com
if your servers are situated in China for better system's performance.
Request Headers
To interact with the API, you'll need to include three essential request headers:
- Gzip Compression: This header helps optimize data transfer between your application and the API.
Accept-Encoding: gzip.
- Keep Alive: In order to increase performance and improve response times.
Connection: keep-alive
- API Key: You can find your API Key on the Travelgate website in API Keys.
Authorization: ApiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
If you don't have an API key yet, you will be able to test the query and mutation examples with a test API key we've added to the playground in the next sections.
Supported Operations
Lastly, please note that the Hotel-X API supports two types of operations:
-
Query
: which are "read-only" and used for retrieving data from our system. You can use queries to search for hotels, check availability... -
Mutation
: which allow for changes, additions, or deletions of data within our system. This is where you can create bookings, update reservations...
But now this quickstart guide will focus on the basics of using the Hotel-X API to make hotel reservations, so let's dive in and get started!
1. Find available hotels based on your search criteria
The Search query is where the adventure begins in our shopping journey! Our aim here is to see what's available within your specified date range and for the number of guests (pax) you have in mind, whether it's for a particular hotel or in your desired destination. This step lets you explore your options before committing to a booking. You can even spice things up by searching with one or more sellers' accesses, giving you the freedom to tailor your search. But hey, for this example, let's kick it off with a simple search for a specific hotel using a particular test Seller.
If you execute the previous search query by clicking on the play button, you'll see an example of how a search response could be, with all the options and rates available for the hotel and criteria requested in the query. For each option, you will receive relevant information such as rate, room type, price, cancellation policies, and more.
This example demonstrates the essential fields for obtaining results but keep in mind that the Hotel-X API offers a wide range of additional fields and functionalities! If you're curious and want to discover all the exciting details, check out the full search step documentation. Happy exploring! 😊🔍
2. Quote your selected option
Now, let's dive into the exciting part! After carefully reviewing all the options in the search results and finding the hotel that perfectly suits your journey, it's time to move forward and request a quote. This quote operation is like getting an exclusive preview before the grand booking. It provides you with up-to-the-minute pricing, a detailed breakdown of your expenses, and crucial information about cancellation policies.
To make this happen, you'll need to retrieve the optionRefId
from the option of the search results that you want to valuate and use this value as the input for the Quote request:
OptionRefID
is a unique identifier assigned to each option. It must not be modified and must not be used or interpreted externally, as it is an internal TGX system identifier.
3. Confirm and book the option!
You're almost there! After securing your quote and ensuring all the details align with your travel plans, it's time to proceed with the booking. In this step, you confirm your reservation and officially lock in your stay.
You'll need to provide the optionRefId
returned in the Quote step and enter all the necessary passenger information. Upon a successful booking request, you'll receive a confirmation along with essential reservation details. Congratulations! Your hotel stay is now officially booked.
Make sure to change the value of the clientReference
field so that the Book can be confirmed correctly.
Next Steps
Congratulations on completing this quickstart tutorial! 🎉 You've successfully learned the basics of creating a sample booking. But there's a world of knowledge waiting for you:
- Explore the Making Requests section to dive deep into how a GraphQL API works and maximize its performance.
- Discover various queries and mutations grouped by the following actions:
- Retrieve static information: Explore accessing static data.
- Make a booking: Learn how to book with more details.
- Manage reservations: Get the hang of reservation management.
- Unleash the full potential of your business with our diverse range of plugins.
Our documentation is a treasure trove of additional features and functionalities to enhance your business. To uncover these valuable resources, explore our documentation further and make the most of these methods. Enjoy your journey!