TravelPayouts API
TravelPayouts Affiliate Network for Your Travel Traffic Monetization
Installation
$ npm install --save travelpayouts-api
Usage
All methods are Promise-based.
const TravelPayouts = ;const api = 'YOUR_TOKEN' 'YOUR_MARKER'; return api;
API
new TravelPayouts(token, marker, options)
Create TravelPayouts API instance
Parameters
token: string
- TravelPayouts API token
marker: string
- TravelPayouts marker
options: object
-
options.url:
string
- TravelPayouts API Base URL -
options.timeout:
number
- Timeout for all requests in total
TravelPayouts.search(segments, options)
Flights search
Parameters
segments: object | Array[object]
-
segments.origin:
string
- origin IATA or string "City, Country (IATA)". IATA code is shown by uppercase letters -
segments.destination:
string
- destination IATA or string "City, Country (IATA)". IATA code is shown by uppercase letters (for example: "Berlin, Germany (BER)"); -
segments.date:
date | string
- departure date, Date object or string in format yyyy-mm-dd
options: object
-
options.host:
string
- host's request (must be replaced by the address of your website where API will be used) -
options.user_ip:
string
- user's ip address -
options.locale:
string
- the language of the search result (en, ru, de, es, fr, pl) -
options.trip_class:
string
- flight class (Y – Economy, C – Business) -
options.passengers:
string
- passenger Information -
options.passengers.adults:
number
- the number of adult passengers (from 1 to 9) -
options.passengers.children:
number
- the number of children (from 0 to 6) -
options.passengers.infants:
number
- the number of infants (from 0 to 6) -
options.know_english:
boolean
- include English-speaking gates in search results -
options.[...] - any additional got options
Returns: promise
Information
About
travelpayouts-api
module is used in production on the avia.ml website.
License
MIT © Evgeny Vlasenko