/ Developers

Retrieve Aiports data using the EasyPNR Web service

IATA, the International Air Transport Association, supports airline activity and helps formulate industry policy and standards. They keep and maintain the IATA codes.

As in airlines, airports eventually can disassociate from IATA due to business reasons or, simply, because of the ending of its operations. Over time, new ones are built, associated, and get an IATA code. IATA association changes and maintain the code list updated.

Keep your airport data always updated

EasyPNR must keep its data updated to provide its services. You can retrieve the always updated data using REST methods of the EasyPNR Web service.

According to the documentation the endpoint to retrieve all airports is https://api.easypnr.com/v4/airports

Example getting the Airport list in Java:

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
//https://gist.github.com/edpichler/79ca8bd1da02aab28d2470e16f95c328
public class EasyPNRExample {

    /**
     * https://www.easypnr.com/webservice
     * @param args
     * @throws Exception
     */

    public static void main(String[] args) throws Exception {

        URL url = new URL("https://api.easypnr.com/v4/airports");
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setRequestProperty("Accept", "application/json");
        conn.setRequestProperty("X-Api-Key", "X vaUMKGUbcjYXUPrzRmQqRUHbJquDw");

        if (conn.getResponseCode() != 200) {
            throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
        }

        BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
        String apiOutput = br.readLine();
        System.out.println(apiOutput);
        conn.disconnect();
    }
}

Downloading all the Airports with IATA codes

If you want to just download all the airports one time, not using the web service, you can follow this post.

Retrieve Aiports data using the EasyPNR Web service
Share this