FlightAware Discussions

Json FlightXML2 API no longer available?

Hi everyone,

I am currently working on a project for university. Therefore i was searching for an API to find historical flight data and i found FlightAware as the best suitable.

The Programm i need is more or a lass exactly the Javascript jQuery example from the documentation. Sadly it isn’t working. When i paste the link for the API in the Browser I get the following message:

Gone

The requested resource
/json/FlightXML2/
is no longer available on this server and there is no forwarding address. Please remove all references to this resource.

For me it says that the API is no longer available under this link any more. Everywhere on the website and within the documentation as well as the example codes there refer to this link.

I am looking forward to your (hopefully fast :slight_smile:) response.

Cheers,
Oliver

Somehow it seems that it connects to the API now, but i get the following message:

NO_DATA no data available

I am still using the data from the example and tried three other Flight codes as well. With the basic account the history data from the past 3 month should be available so therefore i do not understand why it says no data.

The problem in your first message was because it was an incomplete URL, as you did not include the name of the method you want to invoke.

You’ll need to include more details about what request you are making and receiving a NO_DATA response on. Most likely, you are omitting an argument or specifying an incorrect ident.

Heres the relevant part of my code:

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">

var fxml_url = 'http://UserName:APIKey@flightxml.flightaware.com/json/FlightXML2/';


google.load("visualization", "1", {packages:["map"]});

$(document).ready(function() {
    $('#go_button').click(function() {
    $.ajax({
        type: 'GET',
        url: fxml_url + 'FlightInfoEx',
        data: { 'ident': $('#ident_text').val(), 'howMany': 1, 'offset': 0 },
        success : function(result) {
            if (result.error) {
                alert('Failed to fetch flight: ' + result.error);
                return;
            }
            for (flight of result.FlightInfoExResult.flights) {
                if (flight.actualdeparturetime > 0) {
                    // display some textual details about the flight.
                    $('#results').html('Flight ' + flight.ident + ' from ' + flight.origin + ' to ' + flight.destination);

                    // display the route on a map.
                    fetchAndRenderRoute(flight.faFlightID);
                    return;
                }
            }
            alert('Did not find any useful flights');
        },
        error: function(data, text) { alert('Failed to fetch flight: ' + data); },
        dataType: 'jsonp',
        jsonp: 'jsonp_callback',
        xhrFields: { withCredentials: true }
        });
    });
});

i have tried different flight numbers: eg. UAL423, OS511 and CA 841, with OZ 791 the message is “Did not find any useful flights”.

Do you have any fast solution for me, as i have to finish my project by tomorrow evening CETS.

Thanks in advance.

Cheers Oliver

Somehow after a couple of tries the message “Flight UAE128 from LOWW to OMDB” is displayed even if i tried another Flight (EK 128). Could there be a delay with the FlightAware API?

Please keep in mind that we do not recommend use of the Javascript JQuery example due to recent changes in cross-site scripting restrictions in modern web browsers as well as elimination of the “UserName@Password” support by some browsers. Additionally, publicizing your APIKey within the cleartext Javascript source code of public websites is problematic from a security perspective.

We instead recommend server-side use of FlightXML, since this also provides the possibility of your own local server caching and reusing FlightXML responses for multiple web users.