qa
qpx-api
npm i qpx-api
qa

qpx-api

Wrapper for the QPX API (Google flights)

by Mickael Burguet

0.1.0 (see all)License:MITTypeScript:Not Found
npm i qpx-api
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) {
    
});