Searching and acquiring ground transport

API Endpoint

In this guide, we are going to demonstrate how you can find connections between specific locations (cities, bus stations, and train stations).

Acquiring city IDs with Locations API

The steps below will guide you through the process of obtaining city IDs. A hypothetical travel from Prague to London is used as an example (substitute as necessary):

  1. Make a GET request to the following URL:

    https://api.skypicker.com/locations?
  2. Add parameter term with value Prague. Add parameter locations_type with a value city.

  3. Send the request.

    Request example:

    https://api.skypicker.com/locations?term=Prague&locations_type=city
  4. In a response, find an ID of the city. In this case it is:

    "id": "prague_cz"
  5. Save the city ID (prague_cz) for later use.

  6. Repeat the second step. Add parameter term with value London.

    Request example:

    https://api.skypicker.com/locations?term=London&locations_type=city
  7. In a response, find an ID of the city. In this case it is:

    "id": "london_gb",
  8. Save the second city IDs for later use in the subchapter Searching connections between locations.

Acquiring station IDs with Locations API

Some of the railway and bus stations have standard IATA codes (e.g. Prague main train station has XYG code). Kiwi.com has its IDs for stations without IATA codes (e.g. Brno bus station - CZ-BRNO-BRN0).

To find IDs of ground transport stations in a particular city follow the steps below (London is used as an example):

  1. Make a GET request to the following URL:

    https://api.skypicker.com/locations?
  2. Add parameter term with value of the city ID from subchapter Acquiring city IDs with Locations API. In this example it is london_gb. Add parameter locations_type with a value station, bus_station. Parameter station stands for train stations and parameter bus_station, as it appears, stands for bus stations.

    Be aware that airports and train stations can also serve as bus stops. If an airport has a bus or train connection, it also serves as a train station (station) or bus station (bus_station). Same applies for a train station with bus connection; the train station serves as a bus station as well.

  3. Send the request.

    Request example:

    https://api.skypicker.com/locations?term=london_gb&locations_type=station, bus_station
  4. In a response, find the searched station. For example London Baker Street has an ID GB-LOND-LON2.

To use more parameters of Locations API see the following documentation: https://docs.kiwi.com/locations/

To get a list of all locations use dump request through locations API. See the following documentation location API.

Searching connections between locations

To find ground transport connections between locations:

  1. Make a GET request to the following endpoint:

    https://api.skypicker.com/flights?
  2. Now use saved city IDs from subchapter Acquiring city IDs with Locations API. Set the first parameter as fly_from with value prague_cz. Set the second parameter as fly_to with value london_gb

  3. Add parameter v with value 3.

  4. Add parameter as vehicle_type with value train,bus.

  5. Add parameter as date_from with value of the desired departure date. E.g. 20/08/2020. Add sixth parameter as date_to with value of the desired arrival date. E.g. 27/08/2020.

  6. To specify that the trip should take exactly seven days, add parameter as nights_in_dst_from with value 6. Add parameter nights_in_dst_to with value 6.

  7. Add parameter partner and set your afil ID as a value.

  8. Send the request.

    Request example:

    https://api.skypicker.com/flights?fly_from=prague_cz&fly_to=GB-LOND-LON2&v=3&vehicle_type=train,bus&date_from=20/08/2019&date_to=27/08/2019&nights_in_dst_from=6&nights_in_dst_to=6&partner=picky

Optionally, to find connections between stations (and not cities as demonstrated above) use station IDs from subchapter Acquiring station IDs with Locations API in the second step of Searching connections between locations.

To use more parameters of Flights API check the documentation: https://docs.kiwi.com/#flights

  • To obtain a list of all carriers use our Airline API

  • To acquire logos of all carriers substitute <iata_code> in the following URL with the actual carrier code.

    https://images.kiwi.com/airlines/64/<iata_code>.png

Generated by aglio on 08 Nov 2019