Jun 15, 2020

Find a flight using Kiwi.com and Postman

✈️ How long does it take Kiwi.com to find you a flight from Iceland to Mongolia?

???? Prerequisites

As preparation, follow these 2 simple steps:

✅ download, install & register at Postman (5 minutes )

✅ open this site and choose 2 airports. The first one as a departure point and the second one as an arrival point. Write down their codes (5–50 minutes depending on your indecisiveness)

I’ve chosen KEFLAVÍKURFLUGVÖLLUR Airport KEF located in Keflavík near the capital of Iceland, Reykjavík as my departure point.

From there, I would like to visit CHINGGIS KHAAN INTERNATIONAL Airport, ULN located in Ulanbataar, Mongolia

✈️ Let’s find the flight!

Normally we would visit Kiwi.com and look for a flight. But today it’s not the day. We will simulate the request that will be usually executed by the page under the hood and measure how long does it take Kiwi.com to find such an aerial connection.

Step 1 > Build an URL where the request will be sent

Visit docs.kiwi.com. All the so-called endpoints are listed here.

Each of them serves a different purpose. For example locations API whispers to the page all location points such as cities, airports, train stations, etc, where can you travel using Kiwi.com. We are now interested in finding a flight so we’ll use Search API

Copy URL that fetches Basic flights call.

The URL consists of 2 parts

  1. The endpoint at the first row
  2. The query parameters at the second row as the extension helping to define specific content — in our case codes of the airports and time period of the search

To be honest, It’s one row but I split it just for you to get the point.

This is an image so you cannot copy the URL from here 😛

As we would now send a request to the URL, Kiwi.com will search for a flight from Prague to London from 18. November until 12. December 2020. Adjust the URL so it will suit our criteria.

This is yet another image and you still cannot copy the URL. Don’t be lazy and do it yourself 😛

Ok, as we have the URL prepared, the next step would be sending it to the server.

Let’s launch the Postman and prepare our first request.

Log in to Postman, create a simple request and a collection as a basecamp for all your future requests. Like this:

Create a new request and a collection

The next step towards finding your first flight is to enter the request URL, as an address where we would like to send our call. We are fetching data from the server so we keep the GET method selected.

Enter the URL and hit Send.

What happened? We’ve simulated a call that would be usually sent by the frontend (nice and shiny reactive app). Kiwi.com processed our request and found all possible flights based on our parameters sending it back to us(the response).

Response status is 200 which is a standard HTTP code manifesting, that everything is ok. Next to the status you can see the time it took to get the response.

The response body contains all information about flight such as price, duration, exact route, etc. It is encoded in JSON format.

???? Well done! Your first request is completed!

Step 2 > Write your first test!

It would be great if Kiwi.com responds to such requests under a specified amount of time. Your next task is to test that response gets back always under 4 seconds.

Good starter for testing at Postman are the so-called snippets. These prepared blocks of code allow you to write tests immediately.

Use the snippet called Response time is less than 200ms.

The default value here is 200ms for a response to come back, but it takes a bit longer time to process information about all the possible flight options in the world. We’ll need to update it (and the name of the test as well).

Update the test, hit send, and check the result.

???? That’s it! Your first test is completed!

???? You just learned how to send a basic HTTP request to a specified URL with query parameters and measure its time!


1. Add more query parameters

Try to be more exact and add more parameters to your request URL. Specify the passengers with query parameters for instance:

2. Write next test

Use another snippet and write the next test within the same request.

Verify that the response status is 200

Happy testing!


???? My name is Martin Škarbala, but my friends call me Furby(o).

I am currently working as a Testing platform lead at Kiwi.com.

???????? You can find my online courses at learn2code, or some free stuff at youtube.

Join the QA community on slack, or follow me on Facebook / Linkedin

Featured articles
Generating SwiftUI snapshot tests with Swift macros
Don’t Fix Bad Data, Do This Instead