qpx-api

Wrapper for the QPX API (Google flights)

Usage no npm install needed!

<script type="module">
  import qpxApi from 'https://cdn.skypack.dev/qpx-api';
</script>

README

qpx-api

npm version

An API wrapper for QPX (Google flights).

The QPX API is described here.

Install

npm i qpx-api -S

Usage

First, create an instance of the API client:

var QPXApi = require('qpx-api');

var QPXApiClient = new QPXApi({
  api_key: 'your api key',
  timeout: 5000 // timeout in milleseconds
});

Then,

var data = {
  passengers: { adultCount: 1 },
  slice: [
    {
      origin: "YUL",
      destination: "LAS",
      date: "2016-11-11"
    }
  ],
  "solutions": 1
};

QPXApiClient.search(data, function (err, jsonResponse) {
    
});

It can also return a Promise :

QPXApiClient.search(data).then(function (jsonResponse) {
    
}).catch(function (err) {
    
});