REST API Tutorial

How to Use Travel Sabre API

Summary of learning

This tutorial help to consume sabre API using Nodjes and express js. The Sabre providing Travel Solutions APIs to create B2C or B2B travel applications.

This tutorial help to consume sabre API using Nodjes and express js. The Sabre providing Travel Solutions APIs to create B2C or B2B travel applications.

Nodejs is most popular language and expressjs is popular framework.You can use nodejs for client side as well as server side application.I am creating expressjs rest application using nodejs and axios. The axios is http client library that help to create API server client and access resources.

You can use sabre API to get flight information,hotel information, rental car reservation, cruise booking engine and booking information.

There are following steps need to follow to access Sabre API –

Step 1: You need to get Developer API KEY for testing propose.You can signup from here.
Step 2: Obtain You personnel key and shared secret after successful registration.

Step 3: The endpoints is /shop/flights/cheapest/fares/LAX?pointofsalecountry=US

The above Rest API takes the destination city code as a parameter and pointofsalecountry as a optional parameter.

All the sabre API takes authentication token into the rest header section.

Access Sabre API Using ExpressJS

We will create axios client and then access sabre API, we will get response from sabre rest api and console the response.

const axios = require('axios');
const params = {
  authorization: 'Bearer Token',
  query: 'New York'
}

axios.get('https://api.test.sabre.com/v1/shop/flights/cheapest/fares/LAX?pointofsalecountry=US', {params})
  .then(response => {
    console.log(response);
  }).catch(error => {
    console.log(error);
  });

The sabre api return following results –

Results: The Sabre Cheapest fares API Response

  {
    "DestinationLocation": "LAX",
    "FareInfo": [
        {
            "CurrencyCode": "USD",
            "LowestFare": {
                "AirlineCodes": [
                    "AA"
                ],
                "Fare": 91
            },
            "OriginLocation": "IAH",
            "DepartureDateTime": "2020-03-04T00:00:00",
            "ReturnDateTime": "2020-03-04T00:00:00",
            "Links": [
                {
                    "rel": "shop",
                    "href": "https://api.test.sabre.com/v1/shop/flights?origin=IAH&destination=LAX&departuredate=2020-03-04&returndate=2020-03-04&pointofsalecountry=US"
                }
            ]
        }
    ],
    "Links": [
        {
            "rel": "self",
            "href": "https://api.test.sabre.com/v1/shop/flights/cheapest/fares/LAX?pointofsalecountry=US"
        },
        {
            "rel": "linkTemplate",
            "href": "https://api.test.sabre.com/v1/shop/flights/cheapest/fares/?pointofsalecountry="
        }
    ]
}
  
If you have requirements that needs our attentioN

Please feel free to contact us

We would love to hear from you

Share with your network

Facebook
Twitter
LinkedIn
WhatsApp
Email

This tutorial is intended to cover all the essentials steps and insights to understand How to Use Travel Sabre API

Genislab Technologies

Learn further