API Documents

Aircraft Thumbnail

Request

Request URLs for thumbnail look up are in the following format:
http://www.airport-data.com/api/ac_thumb.json?m=XXXXXX&n=N
http://www.airport-data.com/api/ac_thumb.json?m=400A0B&n=2

Parameters

Name Value Example Description
m 6-Char Hex string 400A0B Aircraft MODE-S code in Hex format
n Numeric 2 Max number of results, default is 1
r (optional) String G-KKAZ Aircraft registry, encoded
The API searches aircraft thumbnails in following order:
    1. Mode-S code & Registry
    2. Mode-S code alone
    3. Registry alone.

Results

Results are returned as plain text in JSON format. Results may contain one or more of following keys:
Key Value Example Description
status Int 200 HTTP status code, 200 means ok
count Int 2 Result data count
data Array See following example Thumbnail data
error String Aircraft thumbnail not found. Error message
An example of returned data:
{
  status: 200,
  count: 2,
  data: [
    {
      image: "http://cdn.airport-data.com/images/aircraft/thumbnails/000/582/582407.jpg",
      link: "http://www.airport-data.com/aircraft/photo/000582407.html",
      photographer: "Jan Ittensammer"
    },
    {
      image: "http://cdn.airport-data.com/images/aircraft/thumbnails/000/560/560416.jpg",
      link: "http://www.airport-data.com/aircraft/photo/000560416.html",
      photographer: "Shunn311"
    }
  ]
}				
If an error occured, then the HTTP status code is returned as status code, i.e., 404 for "NOT FOUND". An error message will also be returned where possible.

Each element in data array respresent one thumbnail. For each thumbnail, the result element contains the following data:
Key Value Example Description
image String http://cdn.airport-data.com/images/aircraft/thumbnails/000/924/924555.jpg Thumbnail
link String http://www.airport-data.com/aircraft/photo/000924555.html Link to actual photo
photographer String Graham Reeve Photographer name

Note

In order to not disrupt the layout of 3rd-party application, this API only return thumbnails in landscape orientation.
Thumbnail images are 200 pixels in width. Height vary slightly depending on aspect ratio of original photo.


Airport Info

Request

Request URLs for airport look up are in the following format:
http://www.airport-data.com/api/ap_info.json?icao=ABCD

http://www.airport-data.com/api/ap_info.json?iata=DEF
http://www.airport-data.com/api/ap_info.json?icao=KJFK
    or
http://www.airport-data.com/api/ap_info.json?iata=JFK

Parameters

Name Value Example Description
icao ICAO code KJFK ICAO code (4 chars)
iata IATA code JFK IATA code (3 chars)
If both parameters are supplied, the API searches ICAO first. If no result found, it will then search IATA code.

Results

Results are returned as plain text in JSON format. Results may contain one or more of following keys:
Key Value Example Description
status Int 200 HTTP status code, 200 means ok
icao String KJFK Airport ICAO code
iata String JFK Airport IATA code
name String John F Kennedy International Airport Airport name
location String New York, NY Location of airport
country String United States Country of airport location
country_code String US 2-char country code
longitude Decimal -73.778926 Airport location longitude
latitude Decimal 40.639751 Airport location latitude
link String http://www.airport-data.com/airport/JFK/ Link to airport info page
error String "Airport not found." Error message
An example of returned data:
{
	icao: "KJFK",
	iata: "JFK",
	name: "John F Kennedy International Airport",
	location: "New York, NY",
	country: "United States",
	country_code: "US",
	longitude: "-73.778926",
	latitude: "40.639751",
	link: "http://192.168.124.93/airport/JFK/",
	status: 200
}
				
If an error occured, then the HTTP status code is returned as status code, i.e., 404 for "NOT FOUND". An error message will also be returned where possible.


Status Codes

Airport-Data.com API attempts to return appropriate status code inside its response for every request, which also follows HTTP standard as close as possible. An error message will also be returned where possible.
HTTP status code for API call will be 200 (OK) if the request is processed without incident.
{"error":"Aircraft thumbnail not found."}
Code Text Description
200 OK Success!
304 Not Modified There was no new data to return.
400 Bad Request The request was invalid or cannot be otherwise served. An accompanying error message will explain further.
401 Unauthorized Authentication credentials were missing or incorrect.
403 Forbidden The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why.
404 Not Found The URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the requested format is not supported by the requested method.
406 Not Acceptable Returned by the Search API when an invalid format is specified in the request.
410 Gone This resource is gone. Used to indicate that an API endpoint has been turned off.
429 Too Many Requests Returned when a request cannot be served due to the application's rate limit having been exhausted for the resource.
500 Internal Server Error Something is broken.
502 Bad Gateway Site is down or being upgraded.
503 Service Unavailable The servers are up, but overloaded with requests. Try again later.