API for flight info

suppose I have the flight number (for example CPA85), which method should I use to get the flight data such as origin, destination, departure and arrival dates and aircraft type and details on it.

Thanks :slight_smile:

Hi, you could use FlightInfoStatus. It returns:

ArrayOfFlightInfoStatusStruct - returned results

flights FlightInfoStatusStruct()
actual_arrival_time Timestamp? Runway actual arrival time
actual_blockin_time Timestamp? Actual gate arrival time
actual_blockout_time Timestamp? Actual gate departure time
actual_departure_time Timestamp? Runway actual departure time
adhoc boolean Indicates if the flight is adhoc (no flight plan information available)
aircrafttype string? Aircraft type, ie. B727, C172
airline string? Airline code (ICAO) extracted from the ident
arrival_delay int? Arrival delay (in seconds) based on either actual or estimated gate arrival time. If gate time is unavailable then based on runway arrival time. A negative value indicates the flight is early.
bag_claim string? Baggage claim location at the destinationi airport, if known
blocked boolean Indicates if the flight is blocked from public viewing
cancelled boolean Indicates if the flight was cancelled
codeshares string? Comma separated list of any codeshares operating on this flight.
datalink boolean?
departure_delay int? Departure delay (in seconds) based on either actual or estimated gate departure time. If gate time is unavailable then based on runway departure time. A negative value indiates the flight is early.
destination AirportDisplayStruct? Destination airport code, Lat/Lon location, final Navaid, or blank
display_aircrafttype string? Friendly string representation of the aircraft type
display_filed_altitude string? Display friendly string for the filed altitude
distance_filed int? Distance based on the filed route. May vary from the actual distance flown
diverted boolean Indicates if the flight diverted
estimated_arrival_time Timestamp? Runway estimated arrival time
estimated_blockin_time Timestamp? Estimated gate arrival time
estimated_blockout_time Timestamp? Estimated gate departure time
estimated_departure_time Timestamp? Runway estimated departure time
faFlightID string Unique identifier assigned by FlightAware for this specific flight
filed_airspeed_kts int? Filed IFR airspeed in knots
filed_airspeed_mach int? Filed IFR airspeed in mach number
filed_altitude int? Filed IFR altitude
filed_arrival_time Timestamp? Runway filed arrival time
filed_blockin_time Timestamp? Scheduled gate arrival time
filed_blockout_time Timestamp? Scheduled gate departure time
filed_departure_time Timestamp? Runway filed departure time
filed_ete int? Runway-to-runway filed duration (seconds)
flightnumber string? Flight number extracted from the ident
full_aircrafttype string? Full aircraft type including any suffic and prefix
gate_dest string? Gate at the destination airport, if known
gate_orig string? Gate at the origin airport, if known
ident string Identifier of the flight
inbound_faFlightID string? Unique identifier assigned by FlightAware of the previous flight of the aircraft serving this flight, if known
origin AirportDisplayStruct? Origin airport code, Lat/Lon location, initial Navaid, or otherwise
progress_percent int? Progress bar indicator (0-100), or -1 if not yet departed or unknown
route string? Filed IFR route for the flight
seats_cabin_business int? Number of seats in the business class cabin
seats_cabin_coach int? Number of seats in the coach class cabin
seats_cabin_first int? Number of seats in the first class cabin
status string? Human readable summary of flight status
tailnumber string? Tail number for the aircraft
terminal_dest string? Terminal at the destination airport, if known
terminal_orig string? Terminal at the origin airport, if known
type string General_Aviation or Form_Airline
next_offset int

FlightInfoStatus would be what you want as mentioned above, however, some of the returns are only available on certain tiers, notably AIRLINE GATE AND SCHEDULE DATA

Thanks for the answers
I keep getting “{“The data contract type ‘FlightawareServiceReference.ArrayOfFlightInfoStatusStruct’ cannot be deserialized because the required data members ‘PropertyChanged, flightsField, next_offsetField’ were not found.”}”
when trying to deserialize the result.
have any idea why and what to do?


Hi again am I the only one who gets this error ? What do I do wrong?

You may want to paste your code for others to look at…

here is the code -

private const string fxmlUrl = “http://flightxml.flightaware.com/json/FlightXML3”;
private const string username = “MYUSERNAME”;
private const string apiKey = “MYAPIKEY”;
private static UriBuilder uriBuilder = new UriBuilder(fxmlUrl);

    public static void GetFlightData(string flightName)
        var requestUrl = fxmlUrl.AppendPathSegment("FlightInfoStatus")
                .SetQueryParams(new { ident = "CAP85" });
        ProcessRepositories(requestUrl, username, apiKey).Wait();

    private static async Task ProcessRepositories(string apiUrl, string username, string apiKey)
        var serializer = new DataContractJsonSerializer(typeof(ArrayOfFlightInfoStatusStruct));
        var client = new HttpClient();
        var credentials = Encoding.ASCII.GetBytes(username + ":" + apiKey);
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(credentials));

        var streamTask = client.GetStreamAsync(apiUrl);
            var arrayOfFlightInfoStatusStruct = serializer.ReadObject(await streamTask);// as ArrayOfFlightInfoStatusStruct;
        }catch(Exception e)
            int y1 = 0;

Hi, have considered using an existing library like requests to do the hard work for you?
(I am not sure requests exist for scala, but in python it’s very easy to use and does not create any problems)

It seems from the error message that your serializer/deserializer is too strict and “unforgiving” - you could also try writing a more forgiving variant.