Skip to content
mheadd edited this page Jan 10, 2012 · 5 revisions

The phlair API is a REST-based API for information on flights arriving at and leaving from the Philadelphia International Airport.

The data served by the API is scraped from the phl.org website and is updated every ten minutes.

The phlair API is currently in beta, and is under active development. If you experience an issue when using it, or would like to see a feature added please add an issue.

API Verion

http://api.phlair.info

The current version of the phlair API is 1.0.

List all Departures

http://api.phlair.info/1.0/departures/all

This will list all departures for the current day. The list is returned as a JSON array, with each departing flight as an element of the returned array.

List Departure Information for a Specific Flight

http://api.phlair.info/1.0/departures/{fight-number}

This will list the departure information for a specific flight number. Flight information is returned as a JSON array, with the departing flight(s) matching this number as the elements of the returned array.

[
    {
        "date": "2012-01-10",
        "airline": "Air Canada",
        "flight_number": "343",
        "destination": "TORONTO",
        "time": "11:10 am",
        "gate": "D5",
        "remarks": "On Time"
    }
]

List All Arrivals

http://api.phlair.info/1.0/arrivals/all

This will list all arrivals for the current day. The list is returned as a JSON array, with each arriving flight as an element of the returned array.

List Arrival Information for a Specific Flight

http://api.phlair.info/1.0/arrivals/{fight-number}

This will list the arrival information for a specific flight number. Flight information is returned as a JSON array, with the arriving flight(s) matching this number as the elements of the returned array.

[
    {
        "date": "2012-01-10",
        "airline": "Air Canada",
        "flight_number": "340",
        "origin": "TORONTO",
        "time": "10:32 am",
        "gate": "D5",
        "remarks": "On Time"
    }
]

Note - when querying arrivals or departures for a specific flight number, it is possible to receive multiple flight records in the response. It is assumed that flight numbers are unique to any particular airline for a specific day. In other words, the API works under the assumption that an airline will not reuse a flight number on the same day. However, it is possible to get multiple flights returned if the same flight number is used by multiple airlines:

[
    {
        "date": "2012-01-10",
        "airline": "Air Canada",
        "flight_number": "341",
        "destination": "TORONTO",
        "time": "6:30 am",
        "gate": "D5",
        "remarks": "On Time"
    },
    {
        "date": "2012-01-10",
        "airline": "AirTran Airways",
        "flight_number": "341",
        "destination": "ATLANTA",
        "time": "6:58 pm",
        "gate": "E6",
        "remarks": "On Time"
    }
]

JSONP Suport

The phlair API supports JSONP calls. Simply add the name of the method to wrap the returned JSON in as an additional parameter on flight lookups.

http://api.phlair.info/1.0/arrivals/{fight-number}/callback

This will return the standard flight information JSON wrapped in a method named 'callback' with an HTTP Content-type header of 'application/javascript':

callback([
    {
        "date": "2012-01-10",
        "airline": "Air Canada",
        "flight_number": "340",
        "origin": "TORONTO",
        "time": "10:32 am",
        "gate": "D5",
        "remarks": "On Time"
    }
])

HTTP Response Codes

  • 200 - returned with successful flight information lookups.
  • 404 - returned with unsuccessful flight information lookups (e.g., invalid flight number).
  • 500 - returned when there is an API application error.