Get Hotel Details

node v10.24.1
version: 1.2.0
endpointsharetweet
This sample app shows how to call the Get Hotel Details V1.1 API. This is an orchestrated service that returns rich content for a single property including amenities, media, and room-rates across mulitple content sources. Look to the API Reference for more details: https://beta.developer.sabre.com/docs/rest_apis/hotel/search/get_hotel_details See the Content Services for Lodging page for an overview of everything available: https://beta.developer.sabre.com/docs/travel-agency/content-services-for-lodging
// bring in a helper-library called axios that makes API request code cleaner and easier const axios = require('axios'); // codes for several STX-related hotels const hotelCodeAria = '100004688'; const hotelCodeCaesars = '100099630'; const hotelCodeParis = '100091160'; // specific search criteria const searchHotelCode = hotelCodeAria; const searchCheckIn = '2019-09-01'; const searchCheckOut = '2019-09-05' const requestPayload = { GetHotelDetailsRQ: { SearchCriteria: { HotelRefs: { HotelRef: { HotelCode: searchHotelCode, CodeContext: 'GLOBAL', }, }, RateInfoRef: { CurrencyCode: 'USD', ConvertedRateInfoOnly: false, PrepaidQualifier: 'IncludePrepaid', StayDateRange: { StartDate: searchCheckIn, EndDate: searchCheckOut, }, Rooms: { Room: [ { Index: 1, Adults: 1, Children: 1, ChildAges: '1', }, ], }, RatePlanCandidates: { ExactMatchOnly: false, RatePlanCandidate: [ {}, ], }, InfoSource: '100,110,112,113', }, HotelContentRef: { DescriptiveInfoRef: { PropertyInfo: true, LocationInfo: true, Amenities: true, Descriptions: { Description: [ { Type: 'ShortDescription', }, { Type: 'Alerts', }, { Type: 'Dining', }, { Type: 'Facilities', }, { Type: 'Recreation', }, { Type: 'Services', }, { Type: 'Attractions', }, { Type: 'CancellationPolicy', }, { Type: 'DepositPolicy', }, { Type: 'Directions', }, { Type: 'Policies', }, { Type: 'SafetyInfo', }, { Type: 'TransportationInfo', }, ], }, AdditionalCharges: true, PointOfInterests: true, Airports: true, AcceptedCreditCards: true, GuaranteePolicies: true, }, MediaRef: { MaxItems: 'ALL', MediaTypes: { Images: { Image: [ { Type: 'ORIGINAL', }, ], }, }, AdditionalInfo: { Info: [ { Type: 'CAPTION', value: true, }, ], }, Languages: { Language: [ { Code: 'EN', }, { Code: 'ES', }, { Code: 'IT', }, ], }, }, }, }, }, }; // make the API request axios({ method: 'post', url: 'https://api-crt.cert.havail.sabre.com/v1.1.0/get/hoteldetails', data: JSON.stringify(requestPayload), headers: { 'content-type': 'application/json', accept: 'application/json', authorization: 'Bearer T1RLAQJ05v0bqkNbnIueA8N0e/6rIjk/2xCvwchiRQaQPo/0QDCc4L41AACwvOIp6O+TMhVH3geh9LD3MCvsF1OYW03kYtyUqRGEAN5bHrulrdA+qquoYOg3htVggh/fcX16kOxLTJbl3OnCfYW0MeL7ikhdFMVA9+l9o+ShakiabSyRDGZC1Itc6xvpVz2iz6tA3rwZ64tbM2YwKbzsDndxDT5EcjcwoKDM9Mm9SSnGAzG8ONxP+J8hkgmc10mh4XoSKrP+Ky5JVfQ4TI7IMTcBGzzg0RpOKGS6Dfw*', 'Application-ID': 'SWS1:SBR-CtntSerLgUI:1f06045fcf' } }) .then(function (response) { DisplaySuccessResponse(response); }) .catch(function (error) { DisplayErrorResponse(error); }); function DisplayErrorResponse(error) { console.log('Something went wrong'); console.log(`${error.response.status} ... ${error.response.statusText}`); console.log(error.response.data); } function DisplaySuccessResponse(response) { console.log(response.data); DisplayHotelInfo(response.data.GetHotelDetailsRS.HotelDetailsInfo.HotelInfo); } function DisplayHotelInfo(hotel) { console.log(`Hotel Name: ${hotel.HotelName}`); console.log(`Hotel Rating: ${hotel.SabreRating}`); console.log(`Chain Name: ${hotel.ChainName}`); }
Loading…

no comments

    sign in to comment