# AIRPORT-INFO

<mark style="color:blue;">`GET`</mark> `https://api.kosontechnology.com/airport.php`

This API script is designed to retrieve information from the airport info database using provided parameters.

#### Path Parameters

| Name         | Type   | Description                                                |
| ------------ | ------ | ---------------------------------------------------------- |
| type         | String | To specify the desired airport type.                       |
| iso\_country | String | To specify the desired country.                            |
| iso\_region  | String | To specify the desired region within the selected country. |
| iata\_code   | String | To specify the desire iata\_code.                          |
| gps\_code    | String | To specify the desire icao\_code.                          |
| download     | -      | To download the json file.                                 |

{% hint style="info" %}
This API script is designed to retrieve information from the airport info database using provided parameters. The script constructs the appropriate URL based on the parameters provided and then fetches data from the API. Please follow the instructions below to use this script effectively.
{% endhint %}

## Usage

1. Making an HTTP request via a web browser or API Platform etc. [Postman](https://www.postman.com/).
2. The following parameters are accepted:

<table><thead><tr><th width="158.20000000000002">Name</th><th width="269">Description</th><th>Format</th></tr></thead><tbody><tr><td>type</td><td>To specify the desired airport type.</td><td><ul><li>Airport type. Etc. <strong>large_airport</strong></li></ul></td></tr><tr><td>iso_country</td><td>To specify the desired country.</td><td><ul><li>Country ISO2 code. Etc. <strong>MY</strong></li></ul></td></tr><tr><td>iso_region</td><td>To specify the desired region within the selected country.</td><td><ul><li>ISO2 Code of Country + ISO2 Code of State. Etc. <strong>MY_01</strong></li></ul></td></tr><tr><td>iata_code</td><td>To specify the desire iata_code.</td><td><ul><li>Airport IATA code. Etc. <strong>KUL</strong></li></ul></td></tr><tr><td>gps_code</td><td>To specify the desire icao_code.</td><td><ul><li>Airport ICAO code. Etc. <strong>WMKK</strong></li></ul></td></tr><tr><td>download</td><td>To download the JSON output</td><td><ul><li>This parameter does not require the content, <strong>Leave empty</strong> or <strong>Type anything</strong> is acceptable</li></ul></td></tr></tbody></table>

3. Depending on the parameters provided, the script will construct a URL to fetch information from the Railway Trains - India API.

## **Parameter Guidelines**

* **type Parameter:**
  * If you provide a `type` parameter of airport type etc. '**large\_airport**', the script will retrieve the airport type.
  * There are 5 airport type in this parameter, which are **Small\_airport**, **Medium\_airport**, **Large\_airport**, **Closed** and **Heliport**.
* **`iso_country`** Parameter:
  * If you provide an`iso_country` parameter of country iso2 code etc. '**MY**', the script will retrieve country iso2 code.
* **`iso_region`** Parameter:
  * If you provide an `iso_region` parameter of region iso2 code etc. '**MY\_01**', the script will retrieve region iso2 code.
* **`iata_code`** Parameter:
  * If you provide an `iata_code` parameter of iata\_code etc. '**KUL**', the script will retrieve airport IATA code.
* **`gps_code`** Parameter:
  * If you provide a `gps_code` parameter of icao\_code etc. '**WMKK**', the script will retrieve airport ICAO code.
* **`download` Parameter:**
  * If you want to download the JSON output of these parameter, define the parameter with empty or any input will able you to auto download it. See the download sample at [here](#download).

## ISO2 Code

Refer this [wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#QT) to find your ISO2 Code.

Below is a sample how to find Malaysia ISO2 Code:

1. Find Malaysia and you will see country code at the left column.

<figure><img src="https://3982209870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdwFjmPksROWsH7LWYXB2%2Fuploads%2Fgit-blob-a05205583f6f66bf14516567cc63bb5a07022ca3%2Fimage%20(3).png?alt=media" alt=""><figcaption><p>'MY' is Malaysia's ISO2 Country Code</p></figcaption></figure>

2. Onclick on the code then Wikipedia with direct you to [ISO 3166-2:MY](https://en.wikipedia.org/wiki/ISO_3166-2:MY) where you can find its state code.

<figure><img src="https://3982209870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdwFjmPksROWsH7LWYXB2%2Fuploads%2Fgit-blob-da84e94066c253ce146f76bdb13dc92bda05f797%2Fimage%20(4).png?alt=media" alt=""><figcaption><p>'MY-01' is Johor's ISO2 Region Code</p></figcaption></figure>

## IATA & ICAO(GPS) Code

Refer this [Wikipedia](https://en.wikipedia.org/wiki/Category:Lists_of_airports_by_country) to find your IATA & ICAO(GPS) Code.

Below is a sample how to find Malaysia Airport IATA & ICAO(GPS) Code:

1. Find Malaysia from the list of airports by country.

<figure><img src="https://3982209870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdwFjmPksROWsH7LWYXB2%2Fuploads%2Fgit-blob-ae7267368be91f67fea6f5ea9561a685680a1ccc%2Fimage%20(9).png?alt=media" alt=""><figcaption><p>List of airports by country</p></figcaption></figure>

2. Onclick on the code then Wikipedia with direct you to [List of airports in Malaysia](https://en.wikipedia.org/wiki/List_of_airports_in_Malaysia) where you can find its IATA and ICAO(GPS) code.

<figure><img src="https://3982209870-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdwFjmPksROWsH7LWYXB2%2Fuploads%2Fgit-blob-6259e6ab047d080a07c4e632ce13fb50425bb1cc%2Fimage%20(5).png?alt=media" alt=""><figcaption><p>'AOR" is the IATA Code and 'WMKA' is the GPS code.</p></figcaption></figure>

## Demo

Retrieve all airports data from Malaysia:

{% embed url="<https://api.kosontechnology.com/airport.php?iso_country=MY>" %}
all Malaysia airport data
{% endembed %}

Retrieve all airports data from Malaysia and Johor State:

{% embed url="<https://api.kosontechnology.com/airport.php?iso_country=MY&iso_region=MY-01>" %}
all Johor airport data in Malaysia
{% endembed %}

Retrieve airport data based on IATA code:

{% embed url="<https://api.kosontechnology.com/airport.php?iata_code=KUL>" %}
Kuala Lumpur International Airport data
{% endembed %}

Retrieve airport data based on IATA(GPS) code:

{% embed url="<https://api.kosontechnology.com/airport.php?gps_code=ZBBB>" %}
Beijing Xijiao Airport
{% endembed %}

## Download

Add download at the back of the link to download the database in json format.

{% embed url="<https://api.kosontechnology.com/airport.php?iso_country=MY&download>" %}
download Malaysia airport data
{% endembed %}
