FlightXML Java - Print Altitudes

Hi, I am trying to print a table that has the time and then the altitude for a specific flight. Here is what I have so far:

System.out.println(“---------- PRINT ALTITUDES ----------”);
FlightInfoExRequest flight_req = new FlightInfoExRequest();
FlightInfoExStruct flightstruct = (df.flightInfoEx(flight_req)).getFlightInfoExResult();

I am not getting the output I need, and I’m not sure what method I should be using.

Does anyone have any suggestions?

Thank you!

If the flight has not departed yet, then there likely will not be an interesting altitude for the flight yet.

Are you trying to retrieve the planned cruising altitude, or the current live altitude of the aircraft?

The planned cruising altitude is filed_altitude, as returned by FlightInfoEx.

For the live altitude (and position), you might want to use the “InFlightInfo” function.

I’m trying to get the altitudes of a past flight. Is there a specific method for that?

Altitudes and lat/lon positions for past flights can be found using “GetHistoricalTrack”. Documentation here: https://flightxml.flightaware.com/soap/FlightXML2/doc#op_GetHistoricalTrack
So for this DAL802 flight on 20th Jan: https://flightaware.com/live/flight/DAL802/history/20160120/2045Z/KATL/KLGA
you could use the call:


where faFlightID is FlightAware’s id for that flight.

For positions within the last 24 hours you could use https://flightxml.flightaware.com/soap/FlightXML2/doc#op_SearchBirdseyeInFlight. This allows for a more complicated query, for example if you want flights within a certain lat, lon box.