Skip to content

Flights API

Taras Polishchuk edited this page Oct 20, 2016 · 2 revisions

Flights search api (REST)

Allows to perform a search for a flight fares with various supportive functions.

Supportive methods

  • AirportData - get the airport and/or city name by IATA code
  • AutoComplete - suggests origin/destination options by search string input
  • Rq - search request validation and decomposition (e.g. valid origin/destination/dates)

Sync search

  • SyncSearch - performs flight search and returns the results in a single request
  • SyncSearchExtended - SyncSearch with extended localized data

Async search (optionally)

  • AsyncSearch - creates flight search and could be polled again to check the progress
  • AsyncSearchData - returns actual results of a running/finished AsyncSearch
  • AsyncSearchDataExtended - AsyncSearchData with extended localized data

Usage

Allowed protocol

HTTP and HTTPS both allowed

Response format

All the data provided in JSON

Available languages

There are 3 languages available for localized data: EN, UA, RU

Available currencies

There are 4 currencies available for a fares: USD, EUR, UAH, RUB

Required params for each request

  • key=AUTH_KEY
  • p=PARTNER_NAME

Search Request Hash

Search request hash is a combination of origin (IATA), destination (IATA), departure date (dm), return date (dm, optional, only for roundtrip flights), class (E or B) and passengers (adults,child,infant).

For example: LONBCN05121012E1 (LON-BCN-0512-1012-E-1-0-0)

  • LON is origin
  • BCN is destination,
  • 0512 is December, 5
  • 0712 is December, 7
  • E is Economy class
  • 1 is a number of adults
  • 0 is a number of child (ommited)
  • 0 is a number of infants (ommited)

The 2 zero digits tail could be ommited

Methods

AirportData

Get the airport and/or city name by IATA code

Request params:

code - string (IATA Code)
lang - string (Language Code)

Request example:

/AirportData?key=AUTH_KEY&partner=PARTNER_NAME&code=IEV&lang=EN

Response example:

{
	"success":true,
	"response":"airport-found",
	"data":{    	
		"city":"Kiev",
		"airport":"Zhulhany",
		"code":"IEV"
	},
	"rs":"avalanche-s4",
	"ts":"http",
	"t":0.0088,
	"m":0.11549377441406
}

Rq

Search request validation and decomposition (e.g. valid origin/destination/dates)

Request params:

request - string (Search Request Hash)    

Request example:

/Rq?key=AUTH_KEY&partner=PARTNER_NAME&request=IEVWAW21092309E1  

Response example:

{
	"success":true,
	"response":"config-correct",
	"data": {
		"origin":"IEV",    			
		"destination":"WAW",
		"datefrom":"2017-09-21",
		"dateto":"2017-09-23",
		"type":"RT",
		"class":"E",
		"adults":1,
		"child":0,
		"infant":0
	},
	"rs":"avalanche-s4",
	"ts":"http",
	"t":0.00158,
	"m":0.11382293701172
}

AutoComplete

Search request validation and decomposition (e.g. valid origin/destination/dates)

Request params:

search - string (Text search string)    
lang - string (Language Code)

Request example:

/AutoComplete?key=AUTH_KEY&partner=PARTNER_NAME&search=new&lang=EN

Response example:

{
	"success":true,
	"response":"airports-found",
	"data":[
		{"airport":"all airports","code":"NYC","shift":false,"city":"New York"},
		{"airport":"John F Kennedy","code":"JFK","shift":true,"city":"New York"},
		{"airport":"Newark Liberty","code":"EWR","shift":true,"city":"New York"},
		{"airport":"La Guardia","code":"LGA","shift":true,"city":"New York"},    
		{"airport":"United Kingdom","code":"NCL","shift":false,"city":"New castle"},
		{"airport":"USA","code":"MSY","shift":false,"city":"New Orleans"},
		{"airport":"Australia","code":"ZNE","shift":false,"city":"Newman"},
		{"airport":"USA","code":"ILM","shift":false,"city":"Wilmington"},
		{"airport":"USA","code":"ONP","shift":false,"city":"Newport"},
		{"airport":"USA","code":"HVN","shift":false,"city":"New Haven"},    
		{"airport":"Australia","code":"NTL","shift":false,"city":"Newcastle"},
		{"airport":"USA","code":"EWN","shift":false,"city":"New Bern"},
		{"airport":"United Kingdom","code":"NQY","shift":false,"city":"Newquay"},
		{"airport":"USA","code":"EWB","shift":false,"city":"New Bedford"},
		{"airport":"USA","code":"SWF","shift":false,"city":"Newburgh"},
		{"airport":"New Zealand","code":"NPL","shift":false,"city":"New Plymouth"}
	],
	"rs":"avalanche-s4",
	"ts":"http",
	"t":0.01599,
	"m":0.11978912353516
}

Sync search

Performs flight search and returns the results in a single request

Request params:

request - string (Search Request Hash)
currency - string (Currency CODE)  

---
v - string (version web or mobile, optional)
d - string (device info - OS/Browser/OS_Version/Browser_Version, optional)
utm_source - string (traffic source, optional)  
utm_medium - string (traffic type, optional)  
utm_campaign - string (campaign name, optional)  
utm_term - string (keywords, optional)  
utm_content - string (additional traffic info, optional)  

Request example:

/SyncSearch?key=AUTH_KEY&partner=PARTNER_NAME&request=IEVODS0501E1&currency=USD

Response example:

{
	"success":true,
	"response":"flights-found",
	"data":[
		{
			"fares":[
				{
					"deeplink":"http:\/\/tmeta.click\/deeplink\/flights......",
					"val":50,
					"reseller":"kiwi"
				}
			],
			"directions":[
				{
					"trips":[
						{
							"orig":"KBP",
							"dest":"ODS",
							"deptime":"2017-01-05 19:30:00",
							"arrtime":"2017-01-05 20:30:00",
							"fn":"PS55"
						}
					]
				}
			]
		}
	],
	"rs":"avalanche-s4",
	"ts":"http",
	"t":6.48592,
	"m":1.1196746826172
}

Where:

  • each object in data array is unique flight
  • fares is an array of flight available prices (total request price) from different providers with deeplinks to purchase
  • directions is a list of segments, where directions[0] is always for outbound flights, and directions[1] is always return flights
  • each trip is a flight, from origin (IATA code) to destination (IATA code) with full local time in for departure and arrival. Deptime timezone the same as Origin timezone, and Arrtime timezone is the same as destination timezone
  • fn is a combination of airline supplier (first 2 symbols) and flight number
  • deeplink is an URL to buy this ticket
  • value is total price in the requested currency

Sync search extended

The same as SyncSearch but with extended localized data

Request example:

/SyncSearchExtended?key=AUTH_KEY&partner=PARTNER_NAME&request=IEVODS0501E1&currency=USD&lang=EN

Response example:

     {
     "success": true,
     "response": "flights-found",
     "data": [
       {
        "c": "PS",
        "cn": "Ukraine Intl",
         "id": "56cccbb09b0313a2d81fb160c18bb887",
        "fares": [
           {
             "deeplink": "http://tmeta.click/deeplink/flights...",
             "val": 61,
             "reseller": "Kiwi"
           }
       ],
       "directions": [
         {
           "depdate": "05 Jan, Thu",
           "arrdate": "05 Jan, Thu",
           "deptime": "10:00",
           "arrtime": "11:00",
           "orig": "KBP",
           "dest": "ODS",
           "depcity": "Kiev",
           "arrcity": "Odessa",
           "ns": true,
           "jt": "1h",
           "trips": [
             {
               "orig": "KBP",
               "dest": "ODS",
               "ddate": "05 Jan, Thu",
               "adate": "05 Jan, Thu",
               "dtime": "10:00",
               "atime": "11:00",
               "sup": "PS",
               "fl": 57,
               "ac": "ANY",
               "time": "1h",
               "depcity": "Kiev",
               "arrcity": "Odessa",
               "depname": "Borispol",
               "arrname": "Central",
               "stx": null,
               "st": null
             }
           ]
         },
         {
           "depdate": "07 Jan, Sat",
           "arrdate": "07 Jan, Sat",
           "deptime": "16:55",
           "arrtime": "17:55",
           "orig": "ODS",
           "dest": "KBP",
           "depcity": "Odessa",
           "arrcity": "Kiev",
           "ns": true,
           "jt": "1h",
           "trips": [
             {
               "orig": "ODS",
               "dest": "KBP",
               "ddate": "07 Jan, Sat",
               "adate": "07 Jan, Sat",
               "dtime": "16:55",
               "atime": "17:55",
               "sup": "PS",
               "fl": 58,
               "ac": "ANY",
               "time": "1h",
               "depcity": "Odessa",
               "arrcity": "Kiev",
               "depname": "Central",
               "arrname": "Borispol",
               "stx": null,
               "st": null
             }
           ]
         }
       ],
       "jt_depart": 60,
       "jt_return": 60,
       "cnttip": "Ukraine Intl",
       "filters": {
         "c": {
           "k": "PS",
           "v": "Ukraine Intl"
         },
         "st": {
           "k": 0
         },
         "dep": {
           "dep": "1000",
           "arr": "1100"
         },
         "ret": {
           "dep": "1655",
           "arr": "1755"
         },
         "jt_depart": 60,
         "jt_return": 60,
         "s": 373442,
         "jt": 120
       },
       "tick": "1 ticket"
     },
     {
       "c": "PS",
       "cn": "Ukraine Intl",
       "id": "1a3e9d7707164d357fd03a87baef4ba3",
       "fares": [
         {
           "deeplink": "http://tmeta.click/deeplink....",
           "val": 73,
           "reseller": "Kiwi"
         }
       ],
       "directions": [
         {
           "depdate": "05 Jan, Thu",
           "arrdate": "05 Jan, Thu",
           "deptime": "10:00",
           "arrtime": "11:00",
           "orig": "KBP",
           "dest": "ODS",
           "depcity": "Kiev",
           "arrcity": "Odessa",
           "ns": true,
           "jt": "1h",
           "trips": [
             {
               "orig": "KBP",
               "dest": "ODS",
               "ddate": "05 Jan, Thu",
               "adate": "05 Jan, Thu",
               "dtime": "10:00",
               "atime": "11:00",
               "sup": "PS",
               "fl": 57,
               "ac": "ANY",
               "time": "1h",
               "depcity": "Kiev",
               "arrcity": "Odessa",
               "depname": "Borispol",
               "arrname": "Central",
               "stx": null,
               "st": null
             }
           ]
         },
         {
           "depdate": "07 Jan, Sat",
           "arrdate": "07 Jan, Sat",
           "deptime": "07:00",
           "arrtime": "08:00",
           "orig": "ODS",
           "dest": "KBP",
           "depcity": "Odessa",
           "arrcity": "Kiev",
           "ns": true,
           "jt": "1h",
           "trips": [
             {
               "orig": "ODS",
               "dest": "KBP",
               "ddate": "07 Jan, Sat",
               "adate": "07 Jan, Sat",
               "dtime": "07:00",
               "atime": "08:00",
               "sup": "PS",
               "fl": 56,
               "ac": "ANY",
               "time": "1h",
               "depcity": "Odessa",
               "arrcity": "Kiev",
               "depname": "Central",
               "arrname": "Borispol",
               "stx": null,
               "st": null
             }
           ]
         }
       ],
       "jt_depart": 60,
       "jt_return": 60,
       "cnttip": "Ukraine Intl",
       "filters": {
         "c": {
           "k": "PS",
           "v": "Ukraine Intl"
         },
         "st": {
           "k": 0
         },
         "dep": {
           "dep": "1000",
           "arr": "1100"
         },
         "ret": {
           "dep": "0700",
           "arr": "0800"
         },
         "jt_depart": 60,
         "jt_return": 60,
         "s": 448658,
         "jt": 120
       },
       "tick": "1 ticket"
     }
   ],
   "rs": "avalanche-s4",
   "ts": "http",
   "t": 3.15066,
   "m": 0.16403198242188
  }