|
FlightAware > Commercial Services > FlightXML: Flight Tracking API > DocumentationFlightXML 1.0 DocumentationIndexOverviewAboutThis document contains everything you should need to know to create a fully functional application using FlightAware's FlightXML 1.0 API. Every function available is documented as well as the array result for that query. Additionally, code examples in various languages are provided to make the process as easy as possible. FlightXML 1.0 uses SOAP/WSDL to easily integrate into new or existing applications using any modern development platform. Applications should fetch the FlightXML 1.0 WSDL, parse and cache the result, and then make queries as necessary by submitting SOAP requests directly to FlightAware with your FlightAware-supplied FlightXML key. In order to best support our legacy users that are already using FlightXML 1.0 in production applications, FlightAware has officially frozen the feature set that is currently offered by its WSDL. However, FlightXML 2.0 has been officially released for general availability and offers a number of new functions. When possible, it is strongly recommended that newly developed applications be designed against FlightXML 2.0 instead of 1.0, although FlightAware will continue to maintain the FlightXML 1.0 infrastructure for the forseeable future. AuthenticationTo access FlightXML 1.0, all requests must include a username and FlightXML Key (don't have one?). This data is transmitted via basic HTTP Authentication methods that encode user:key in base64 and send the data to the FlightXML server as the "Authorization" header as part of the HTTP request. Most programming languages and HTTP/SOAP/XML/WSDL packages allow you to specify your username and password as an argument for the request so that the authentication is transparent to your application as it makes requests. Web Services / WSDLView: FlightXML 1.0 WSDL XML Although you can read the WSDL and generate SOAP queries manually, it is recommended that you develop your applications to automatically parse the WSDL and populate your application namespace with the FlightXML functions. Additionally, it is strongly suggested that you ensure that your applications cache the WSDL file so that it is not necessary to fetch and parse the WSDL for every request or instance of your application. This will vastly improve the performance and efficiency of your application. The FlightXML 1.0 WSDL uses the "RPC/Encoded" method for encoding SOAP requests and responses. This is a widely understood method that has a broad level of compatiblity with SOAP clients from numerous languages. However, more recent SOAP industry standards dictate that the newer "Document/Literal" method should be used for SOAP requests and responses. Users that have a need or preference to using this newer method are encouraged to develop against FlightXML 2.0 instead. Procedures / Functions
FlightInfo
InFlightInfo GetLastTrack Search SearchCount Scheduled Departed Enroute FleetArrived Arrived AllAirports ZipcodeInfo AirportInfo TailOwner RoutesBetweenAirports AircraftType countAirportOperations blockIdentCheck METAR TAF NTAF LatLongsToDistance LatLongsToHeading MapFlight_Beta FlightInfoFlightInfo returns information about flights for a specific tail number (e.g., N12345) or ICAO airline and flight number (e.g., SWA2558) and the maximum number of flights to be returned. Flight information will be returned from newest to old est with the oldest not being more than 3-4 days in the past. Times are in integer seconds-since-1970 (UNIX epoch) time, except for estimated time enroute, which is in hours and minutes.
InFlightInfoInFlightInfo looks up a specific tail number (e.g., N12345) or ICAO airline and flight number (e.g., SWA2558) and returns current position/direction/speed information. It is only useful for airborne flights.
GetLastTrackGetLastTrack looks up a flight by specific tail number (e.g., N12345) or ICAO airline and flight number (e.g., SWA2558). It returns the track log from the current IFR flight or, if the aircraft is not airborne, the most recent IFR flight. It returns an array of positions, with each including the timestamp, longitude, latitude groundspeed, altitude, altitudestatus, updatetype, and altitudechange. Altitude is in hundreds of feet or Flight Level where appropriate, see http://flightaware.com/about/faq.rvt#flightLevel. Also included altitude status, update type, and altitude change Altitude status is 'C' when the flight is more than 200 feet away from its ATC-assigned altitude. (For example, the aircraft is transitioning to its assigned altitude.) Altitude change is 'C' if the aircraft is climbing (compared to the previous position reported), 'D' for descending, and empty if it is level. This happens for VFR flights with flight following, among other things. Timestamp is integer seconds-since-1970.
SearchSearch searches data on all airborne aircraft to find ones matching the search query. Query parameters include a latitude/longitude box, aircraft ident with wildcards, type with wildcards, prefix, suffix, origin airport, destination airport, origin or destination airport, groundspeed, and altitude. It takes search terms in a single string comprising "-key value" pairs and returns an array of flight structures.Keys include:
To search for all aircraft below ten-thousand feet with a groundspeed over 200 kts:
-belowAltitude 100 -aboveGroundspeed 200
To search for all in-air Boeing 777s:
-type B77*
To search for all aircraft heading to Los Angeles International Airport (LAX) that are "heavy" aircraft:
-destination LAX -prefix H
To search for all Continental Airlines flights in Boeing 737s
-idents COA* -type B73*
SearchCountSearchCount works like Search but returns a count of matching flights rather than information about each flight.
ScheduledScheduled returns information about scheduled flights (technically, filed IFR flights) for a specified airport and a maximum number of flights to be returned. Scheduled flights are returned from soonest to furthest in the future to depart. The airport argument must be the ICAO airport ID (e.g., KLAX, KSFO, KIAH, KHOU, KJFK, KEWR, KORD, KATL, etc. The howMany argument must be an integer value less than or equal to 15 and determines the number of results. The offset argument must be an integer value of the offset row count you want the search to start at. Most requests should be 0. The filter argument can be "ga" or "airline" to only show GA or Airline traffic, respectively, or null/empty to show all traffic. The next_offset value returned advises an application of the next offset to use (if more data is available). Times returned are UNIX epoch (integer seconds since 1970) format.
DepartedDeparted returns information about already departed flights for a specified airport and maximum number of flights to be returned. Departed flights are returned in order from most recently to least recently departed. The airport argument must be the ICAO airport ID (e.g., KLAX, KSFO, KIAH, KHOU, KJFK, KEWR, KORD, KATL, etc. The howMany argument must be an integer value less than or equal to 15 and determines the number of results. The offset argument must be an integer value of the offset row count you want the search to start at. Most requests should be 0. The filter argument can be "ga" or "airline" to only show GA or Airline traffic, respectively, or null/empty to show all traffic. The next_offset value returned advises an application of the next offset to use (if more data is available).
EnrouteEnroute returns information about flights already in the air for the specified airport and maximum number of flights to be returned. Enroute flights are returned from soonest estimated arrival to least soon estimated arrival. The airport argument must be the ICAO airport ID (e.g., KLAX, KSFO, KIAH, KHOU, KJFK, KEWR, KORD, KATL, etc. The howMany argument must be an integer value less than or equal to 15 and determines the number of results. The offset argument must be an integer value of the offset row count you want the search to start at. Most requests should be 0. The filter argument can be "ga" or "airline" to only show GA or Airline traffic, respectively, or null/empty to show all traffic. The next_offset value returned advises an application of the next offset to use (if more data is available).
FleetArrivedThe fleet argument must be an ICAO prefix (e.g., COA, DAL, UAL, OPT, etc.) The howMany argument must be an integer value less than or equal to 15 and determines the number of results. The offset argument must be an integer value of the offset row count you want the search to start at. Most requests should be 0. The next_offset value returned advises an application of the next offset to use (if more data is available).
ArrivedArrived returns information about flights that have recently arrived for the specified airport and maximum number of flights to be returned. Flights are returned from most to least recent. The airport argument must be the ICAO airport ID (e.g., KLAX, KSFO, KIAH, KHOU, KJFK, KEWR, KORD, KATL, etc. The howMany argument must be an integer value less than or equal to 15 and determines the number of results. The offset argument must be an integer value of the offset row count you want the search to start at. Most requests should be 0. The filter argument can be "ga" or "airline" to only show GA or Airline traffic, respectively, or null/empty to show all traffic. The next_offset value returned advises an application of the next offset to use (if more data is available).
AllAirportsAllAirports returns the ICAO airport IDs of all known airports.
ZipcodeInfoZipcodeInfo returns information about a five-digit zipcode. Of particular importance is latitude and longitude.
AirportInfoAirportInfo returns information about an airport given an ICAO airport code such as KLAX, KSFO, KORD, KIAH, O07, etc. Data returned includes name (Houston Intercontinental Airport), location (typically city and state), latitude and longitude.
TailOwnerTailOwner returns information about an the owner of an aircraft, given a flight number or N-number. Data returned includes owner's name, location (typically city and state), and website, if any.
RoutesBetweenAirportsRoutesBetweenAirports returns information about assigned IFR routings between two airports. For each known routing, the route, number of times that route has been assigned and the filed altitude are returned.AircraftTypeGiven an aircraft type string such as GALX, AircraftType returns information about that type, comprising the manufacturer (for instance, "IAI"), type (for instance, "Gulfstream G200"), and description (like "twin-jet").
countAirportOperationsGiven an airport, returns integer values on the number of aircraft scheduled or actually en route or departing from the airport. Scheduled arrival is a non-airborne flight that is scheduled to the airport in question.
blockIdentCheckGiven an aircraft identification, returns 1 if the aircraft is blocked from public tracking, 0 if it is not.
METARGiven an airport, return the METAR weather info, if available.
TAFGiven an airport, return the terminal area forecast, if available.
NTAFGiven an airport, return the terminal area forecast, if available.
LatLongsToDistanceGiven two latitudes and longitudes, lat1 lon1 lat2 and lon2, respectively, determine the great circle distance between those positions in miles.
LatLongsToHeadingGiven two latitudes and longitudes, lat1 lon1 lat2 and lon2, respectively, calculate and return the initial compass heading (where 360 is North) from position one to position two. Quite accurate for relatively short distances but since it assumes the earth is a sphere rather than on irregular oblate sphereoid may be inaccurate for flights around a good chunk of the world, etc.
MapFlight_BetaThis function will return a base64 encoded GIF (with the height and width as specified in pixels) of the most recent (past or current) flight of a specified ident. This service is in beta. Future versions will allow viewing of past flights, configuring nexrad, and configuring zoom.
Classes/StructsDepartureStructTafStruct FlightStruct ScheduledFlightStruct EnrouteStruct AirportInfoStruct TrackStruct ArrivalStruct ZipcodeInfoStruct AircraftSuffixDescriptionStruct RoutesBetweenAirportsStruct MetarStruct InFlightAircraftStruct EnrouteFlightStruct ScheduledStruct InFlightStruct countAirportOperationsStruct TailOwnerStruct DepartureFlightStruct AircraftTypeStruct ArrivalFlightStruct FlightInfoStruct
DepartureStructTafStructFlightStructScheduledFlightStructEnrouteStructAirportInfoStructTrackStructArrivalStructZipcodeInfoStructAircraftSuffixDescriptionStructRoutesBetweenAirportsStructMetarStructInFlightAircraftStructEnrouteFlightStructScheduledStructInFlightStructcountAirportOperationsStructTailOwnerStructDepartureFlightStructAircraftTypeStructArrivalFlightStructFlightInfoStructEnumerationsArray Types
ExamplesMicrosoft .NETSave file as test.cs:
using System.Net;
class test {
public static void Main(string[] args)
{
DirectFlight df = new DirectFlight();
df.Credentials = new NetworkCredential("sampleUser", "abc123abc123abc123abc123abc123");
df.PreAuthenticate = true;
EnrouteStruct r = df.Enroute("KAUS", 10, "", 0);
foreach (EnrouteFlightStruct e in r.enroute) {
System.Console.WriteLine(e.ident);
}
System.Console.WriteLine(df.METAR("KAUS"));
}
}
Run commands: wsdl http://flightaware.com/commercial/flightxml/data/wsdl1.xml csc test.cs DirectFlight.cs test.exe PHP
Requirements
Save file as test.php:
<?php
require_once('SOAP/Client.php');
$DirectFlight_Authentication = array(
'user' => 'sampleUser',
'pass' => 'abc123abc123abc123abc123abc123abc123',
);
$wsdl_url = 'http://flightaware.com/commercial/flightxml/data/wsdl1.xml';
$WSDL = new SOAP_WSDL($wsdl_url,$DirectFlight_Authentication);
$soap = $WSDL->getProxy();
$result = $soap->Enroute('KIAH',10,'airline',0);
print "Aircraft en route to KSMO:\n";
$flights = $result->enroute;
foreach ($flights as $flight) {
print $flight->ident . " (" . $flight->aircrafttype . ") \t" .
$flight->originName . " (" . $flight->origin . ")\n";
}
?>
Perl
Requirements
Save as test.pl:
#!/usr/bin/env perl
# API Configuration
my $username = "sampleUser";
my $apiKey = "abc123abc123abc123abc123abc123abc123";
# Example code
use strict;
use DirectFlight;
use SOAP::Lite;
sub SOAP::Transport::HTTP::Client::get_basic_credentials {
return $username => $apiKey;
}
my $DF = new DirectFlight;
my $enroute = $DF->Enroute('KSMO',10,'',0);
print "Aircraft en route to KSMO:\n";
my $flights = $enroute->{enroute};
foreach my $flight (@$flights) {
print $flight->{'ident'} . " (" . $flight->{'aircrafttype'} . ") \t" .
$flight->{'originName'} . " (" . $flight->{'origin'} . ")\n";
}
Run commands: perl /usr/local/bin/stubmaker.pl -v http://flightaware.com/commercial/flightxml/data/wsdl1.xml ./test.pl Java
Requirements
Save as test.java:
import com.flightaware.directflight.soap.DirectFlight.*;
class test {
public static void main(String[] args)
{
try {
DirectFlightLocator locator = new DirectFlightLocator();
DirectFlightSoap df = locator.getDirectFlightSoap();
DirectFlightSoapStub stub = (DirectFlightSoapStub)df;
stub.setUsername("sampleUser");
stub.setPassword("abc123abc123abc123abc123");
EnrouteStruct r = df.enroute("KAUS", 10, "", 0);
for (EnrouteFlightStruct e: r.getEnroute()) {
System.out.println(e.getIdent());
}
System.out.println(df.METAR("KAUS"));
} catch (javax.xml.rpc.ServiceException x) {
System.err.println(x);
} catch (java.rmi.RemoteException x) {
System.err.println(x);
}
}
}
Windows-specific build (requires wsdl1.xml): set CLASSPATH=axis-1_4\lib\axis-ant.jar;axis-1_4\lib\axis.jar;axis-1_4\lib\commons-discovery-0.2.jar; axis-1_4\lib\commons-logging-1.0.4.jar;axis-1_4\lib\jaxrpc.jar;axis-1_4\lib\log4j-1.2.8.jar; axis-1_4\lib\saaj.jar;axis-1_4\lib\wsdl4j-1.5.1.jar;. java org.apache.axis.wsdl.WSDL2Java wsdl1.xml javac test.java java test TclComing soon Python
Requirements
Save the following as test.py:
#!/usr/bin/env python
from SOAPpy import Config, HTTPTransport, SOAPAddress, WSDL
username = 'sampleuser'
apiKey = 'abc123abc123abc123abc123abc123abc123'
wsdlFile = 'http://flightaware.com/commercial/flightxml/data/wsdl1.xml'
# This is a custom HTTP transport that allows Basic Authentication.
class myHTTPTransport(HTTPTransport):
username = None
passwd = None
@classmethod
def setAuthentication(cls,u,p):
cls.username = u
cls.passwd = p
def call(self, addr, data, namespace, soapaction=None, encoding=None,
http_proxy=None, config=Config):
if not isinstance(addr, SOAPAddress):
addr=SOAPAddress(addr, config)
if self.username != None:
addr.user = self.username+":"+self.passwd
return HTTPTransport.call(self, addr, data, namespace, soapaction,
encoding, http_proxy, config)
# Make a FlightXML server request.
myHTTPTransport.setAuthentication(username, apiKey)
DF = WSDL.Proxy(wsdlFile, transport=myHTTPTransport)
enroute = DF.Enroute('KSMO',10,'',0)
flights = enroute['enroute']
print "Aircraft en route to KSMO:"
for flight in flights:
print "%s (%s) \t%s (%s)" % ( flight['ident'], flight['aircrafttype'],
flight['originName'], flight['origin'])
Run commands: ./test.py RubyA non-officially supported project for interfacing with FlightXML has been developed by a member of the FlightAware community. An updated version of that project can be accessed at GitHub. Requirements
Save the following as test.rb:
#!/usr/bin/env ruby
require 'DirectFlightDriver.rb'
username = 'sampleuser'
apiKey = 'abc123abc123abc123abc123abc123abc123'
$df = DirectFlightSoap.new(username, apiKey)
enroute = $df.Enroute('KSMO',10,'',0)
flights = enroute.enroute
print "Aircraft en route to KSMO:\n"
flights.each { |flight|
print "#{flight.ident} (#{flight.aircrafttype}) \t#{flight.originName} (#{flight.origin})\n"
}
Run commands: ./test.rb |