Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

travelpayouts-api

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

travelpayouts-api

TravelPayouts API

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

TravelPayouts API Build Status

TravelPayouts Affiliate Network for Your Travel Traffic Monetization

Installation

$ npm install --save travelpayouts-api

Usage

All methods are Promise-based.

const TravelPayouts = require('travelpayouts-api');
const api = new TravelPayouts('YOUR_TOKEN', 'YOUR_MARKER');

return api.search({
  origin: 'NYC',
  destination: 'HKT',
  date: new Date(),
})
.then(res => {
  console.log(res.results);
})
.catch(err => {
  console.error(err.stack || err.message);
});

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

Keywords

FAQs

Package last updated on 06 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc