Airports API

Description

Lookup a specific airport to find out about its regional information.

Endpoint

> GET https://api.jsonrepo.com/v1/knowledge/transportation/airports

Headers

Field Description
api_key Required Your API Key

Parameters

Field Type Description
code String Optional The airport IATA code
name String Optional The airport name

Parameter Requirement:

You must provide either the code or name parameter. If neither is provided, the execution will fail. If both are provided, an OR comparison will be executed.

Response

A successful request will result in a populated payload field with the expected output.

Response Limit:

This endpoint enforces a maximum of 10 entries response limit.

A failed request will result in an error output as detailed in Error Rules. If the endpoint validation fails due to missing, badly formatted or invalid parameters, the endpoint will return HTTP code 400 along with a message detailing the error.

See the examples section for more information.

Request

  • Curl
// Look up `SFO`

curl -G \
https://api.jsonrepo.com/v1/knowledge/transportation/airports \
-H "api_key: {YOUR_API_KEY_HERE}" \
--data-urlencode "code=SFO"

Success Response

{
    "http_code": 200,
    "http_message": "Ok",
    "message": "Successful execution",
    "payload": {
        "airports": [
            {
                "id": 4991,
                "iata_code": "SFO",
                "name": "San Francisco International",
                "city": "San Francisco, CA",
                "country": "United States",
                "country_code_2": "US",
                "coordinates": {
                    "latitude": 37.618889,
                    "longitude": -122.375
                },
                "db_entry_last_updated_at": "2024-08-01 11:35:14"
            }
        ]
    }
}

Error Response Examples

// Request with missing `code` and `name` parameters

{
    "http_code": 400,
    "http_message": "Bad Request",
    "message": "Malformed request: `code` and `name` parameters were not provided. One of them must be supplied.",
    "payload": []
}