Basic API call with Meteor



I’m learning Meteor and am trying to get a basic API call to work. I get a 200 status code, but no routes.

On the server side I have:

var url = "";

    callFltAware: function() {
        return HTTP.get(url, {
        auth: "user:key",
    query: {"origin": "x", "destination": "x"} 

And on the client side:{
    "click input": function() {
})"callFltAware", function(e,r) {
	if (!e && r) {
		var plans = JSON.parse(r.content);

On the console I get:

Object {statusCode: 200, content: “{“RoutesBetweenAirportsResult”:{“data”:]}}↵”, headers: Object, data: Object}
content: "{“RoutesBetweenAirportsResult”:{“data”:]}}↵"
data: Object
RoutesBetweenAirportsResult: Object
data: Array[0]
length: 0
proto: Array[0]
proto: Object
proto: Object
headers: Object
statusCode: 200
proto: Object

The data array is empty. I’m new to web dev, so maybe this is a simple fix.


Recent routes might not always be available between two arbitrary airports. Try some other locations, preferable both in the U.S. to first establish that your code is working. For example: … ation=KAUS

{“RoutesBetweenAirportsResult”:{“data”:{“count”:10,“route”:“IDU5 IDU WLEEE BITER6”,“filedAltitude”:100},{“count”:2,“route”:“IDU5 IDU CWK AUS”,“filedAltitude”:60},{“count”:2,“route”:“IDU5 IDU CWK”,“filedAltitude”:40}]}}


Thanks. I’ve tried numerous combinations, but the nothing turns up. I get the RoutesBetweenAirportsResult object so it’s partially working, but the data array is always [0].

A similar call using just Node.js works fine:

var http = require('http');
var rest = require('restler');

var fxml_url = '';
var username = 'user';
var apiKey = 'key';

var origin = 'KIAD';
var destination = 'KORD';

rest.get(fxml_url + 'RoutesBetweenAirports', {
	username: username,
	password: apiKey,
	query: {origin: origin, destination: destination}
}).on('success', function(result, resp) {
	console.log('Filed routes between ' + origin + ' and ' + destination + ':');
	var r =;
	for (var i = 0; i < r.length; i++) {
		console.log('Route: ' + r*.route + '
' +
			'Altitude: ' + r*.filedAltitude);



It works with Node.js, so the problem is just with your Meteor implementation and not our server side.

You might try changing how you are logging to the console so that the output is actually a deep, serialized representation of everything, rather than just the top-level of things, before printing just “Object” or “Array”. The data might actually be there, but just not logged properly to your console.


I ended up getting it working by taking the arguments out of the query and putting them directly into the URL. Probably not the most elegant solution but ok for now:

	callFltAware: function(origin, destination) {
      try {
        var result ="GET", url + "?origin=" + origin + "&destination=" + destination, {
    		auth: "user:pass", 
        return result
      } catch (e) {
        console && console.log && console.log('Exception calling', url)
        throw e