Hotels :hotel:
Current version of package provides Travelport Rooms and More via Universal API content.
Read docs for more information.
// HotelService creation example
var uAPI = require('uapi-json');
var auth = {
username: 'someusename',
password: 'some password',
targetBranch: 'some tb',
};
var HotelService = uAPI.createHotelService(auth, 0, true);
API
HotelService
.search(params)
Synchronous Hotel Search returns a list of available hotel property offers that meet the requested search criteria. The Hotel Search is the first transaction in the workflow for Hotel Shopping and Booking.
Returns: Promise
See: Synchronous Hotel Search
Param | Type | Description |
---|---|---|
location | String |
IATA Code of City/Airport to search hotels. |
startDate | String |
Check-in date in format YYYY-MM-DD . |
endDate | String |
Check-in date in format YYYY-MM-DD . |
rooms | Array<Room> |
Array of Room objects. See below. |
[MaxWait] | Number |
Max wait for results. |
[MaxProperties] | Number |
Max properties to return. |
[currency] | String |
Preferred currecny. |
[rating] | Array |
Array of ratings needed to search. Ex [3, 4, 5] for 3,4,5-star hotels. |
Room object
One element in rooms
array = 1 room to search.
Each room contains next object:
Param | Type | Description |
---|---|---|
adults | Number |
Number of adults. |
children | Array<Number> |
Each element === one child. Number - child age. Ex. [10, 12] means two children 10 and 12 years old. |
See: Search example
.rates(params)
A Hotel Rate and Rule Search, also known as a Complete Hotel Availability, returns room rates and rate rules for a specified hotel property offer. After the user/traveler has selected a property from the Hotel Search response, a more detailed search for rates for the property and stay can be made.
Returns: Promise
See: Stand-Alone Hotel Rate and Rule Search
Param | Type | Description |
---|---|---|
HotelChain | String |
Chain from search response. |
HotelCode | String |
Hotel code from search response. |
startDate | String |
Check-in date in format YYYY-MM-DD . |
endDate | String |
Check-in date in format YYYY-MM-DD . |
rooms | Array<Room> |
Array of Room objects. See above. |
Suppliers | Array<SupplierCode> |
Array of supliers codes. Ex. ['AG', 'RS'] |
[HostToken] | String |
HostToken for non-standalone request. |
[currency] | String |
Preferred currency. |
See: Rates example
.book(params)
After a hotel property and rate is selected in the Hotel Rate and Rule Search response, the hotel segment can be reserved.
Returns: Promise
See: Creating Hotel Bookings
Param | Type | Description |
---|---|---|
people | Arrat<People> |
People array. See below |
Guarantee | Object |
Credit Card information. See below |
rates | Array<Rate> |
Selected rates for booking. See below |
roomsRefs | Array<RoomRef> |
Array of linked people to rooms. See below |
HotelChain | String |
Chain from search response. |
HotelCode | String |
Hotel code from search response. |
startDate | String |
Check-in date in format YYYY-MM-DD . |
endDate | String |
Check-in date in format YYYY-MM-DD . |
HostToken | String |
HostToken for non-standalone request. |
People object
First element should contain contact information Each people object has nex fields:
Param | Type | Description |
---|---|---|
key | Number |
Unique key. Will be used in RoomRef object. |
TravelerType | String |
One of [ ADT, CHD ] . |
[Age] | Number |
Requried for child. Age in years. |
FirstName | String |
First name. |
LastName | String |
Last name. |
PrefixName | String |
One of [MISS, MR, MRS] . |
Nationality | String |
2-letter country code. Ex. US |
BirthDate | String |
Date in format YYYY-MM-DD . |
AreaCode | Number |
Area code of phone number. |
CountryCode | Number |
Country code of phone number. |
Number | Number |
Phone number. |
String |
Email adress. | |
Country | String |
2-letter country code. Ex. US . |
City | String |
City name. |
Street | String |
Street name. |
PostalCode | Number |
Postal code. |
Guarantee object
Object that store information about credit card.
Param | Type | Description |
---|---|---|
CVV | Number |
3-digit number. |
ExpDate | String |
Expiration date in format YYYY-MM . |
CardHolder | String |
Name of card holder. Should have 2 words. |
CardNumber | String |
Card number. |
CardType | String |
2-letter card type. Ex. MC for Mastercard. VI for Visa. |
BankName | String |
Credit card bank name. |
BankCountryCode | String |
2-letter country code. |
Rate object
Each rate object can be cloned from rate response. Has next shape:
Param | Type |
---|---|
RatePlanType | String |
RateSupplier | String |
RateOfferId | String |
Total | String |
Base | String |
Surcharge | String |
Tax | String |
RoomRef object
Each object represents one room and people from people
array, that are linked to this room.
Param | Type | Description |
---|---|---|
adults | Number |
Count of adults in room. |
adultsRefs | Array<key> |
Keys from people array. |
children | Object{age, key} |
Object with age and key of children. |
See: Book example
.cancelBook(params)
Currently, cancellation is supported only for single room hotel reservations. Hotel cancellation via Universal API or the Travelport Rooms and More web site is not supported for multiple rooms in this release. The aggregator must be contacted directly to cancel or modify a multiple room booking.
Returns: Promise
See: Canceling Hotel Bookings
Param | Type | Description |
---|---|---|
LocatorCode | String |
Locator code from book resonse. |
Example
See: Cancel example