SearchBirdseyeInFlight Function Returning Unexpected Results


#1

I’ve been getting unexpected results when using the SearchBirdseyeInFlight method.

According to the docs at http://flightxml.flightaware.com/soap/FlightXML2/doc#op_SearchBirdseyeInFlight the below code should return me X number of results (based on the “howMany” input variable) that match my query filters. As you can see from the attached results and code, the howMany variable does not seem to limit the number of results returned and perhaps I am missing something but my queries do not seem to filter out results.

My ultimate goal is to query for flight info (unique key, currently in the air, destination, and lat/long) of X number of and then periodically query for an updated status and lat/long of those flights. I’ve looked into using the Enroot method where the “howMany” and “dest” variables do seem to work and then querying the flight ident of each of the results with the “flightInfo” method but the flightInfo method does not return a lat/long and also seems to return multiple results for a single ident for some reason.


var util = require(‘util’);
var restclient = require(‘restler’);

var fxml_url = ‘http://flightxml.flightaware.com/json/FlightXML2/’;
var username = ;
var apiKey = ;

restclient.get(fxml_url + ‘SearchBirdseyeInFlight’, {
username: username,
password: apiKey,
howMany: 1,
offset: 0,
//query : {ident : ‘ASA771’}
//query : {dest : ‘OAK’, inAir : true}
query : {dest : ‘OAK’}
}).on(‘success’, function(result, response) {
console.log(‘Aircraft Info:’);
var flights = result.SearchBirdseyeInFlightResult.aircraft;

//util.puts(util.inspect(flights));
 for (i in flights) {
  var flight = flights[i];
  //util.puts(util.inspect(flight));
  console.log(flight.ident + " " + flight.destination + ", " + flight.longitude + ", " + flight.latitude);
 }

});

flightawareresults


#2

What does the response url end up looking like for your request? Here’s what it should be:

http://flightxml.flightaware.com/json/FlightXML2/SearchBirdseyeInFlight?query={= dest KOAK}&howMany=1&offset=0

I’m guessing the request is not well formed and that’s why you’re not seeing the expected behavior.