How to set maximum results size properly using Nodejs


#1

Howdy,
I’m implementing a test script using NodeJS and restler to pull airport departure data. I know that I need to set the variable SetMaximumResultSize for my account (at least once) to allow > 15 results to be returned, but I’m a JS noob and It’s not clear to me how I set that. Is it passed as part of the URL? a term in the query? Any tips (or examples!) are greatly appreciated.

Matthew


#2

Have you already seen the nodejs example that is on the documentation page? Or demonstrates how to call some other JSON methods in FlightXML. Calling SetMaximumResultSize is very similar.


#3

Thank you for getting back to me. I have been using the documentation example as a template, and I have a working script that requests Scheduled data and writes it out to a text file using log.write. It’s taken me a bit to get here but it’s starting to make sense. I’m imagining I’d need to start with a restclient.post call or something similar and maybe get it to work but it would be a lot of fumbling around.

TIA,
Matthew


#4

This is what I have so far:


restclient.get(fxml_url + 'SetMaximumResultSize', {
	username: username,
    password: apiKey,
    query: {max_size: 24}
   
}).on('success', function(result, response) {    
     util.puts('Max Size successfully set to 24');
 }
);

It returns a successful query but the results number stays at 15. Anyone with some guidance?

Thanks, Matt P.


#5

It seems to work for me:



restclient.get(fxml_url + 'SetMaximumResultSize', {
    username: username,
    password: apiKey,
    query: {max_size: 24}
}).on('success', function(result, response) {
    util.puts('successfully set');

    restclient.get(fxml_url + 'MetarEx', {
        username: username,
        password: apiKey,
        query: {airport: 'KAUS', howMany: 30}
    }).on('success', function(result, response) {
        util.puts('Got ' + result.MetarExResult.metar.length);
    });

});


Output is:

successfully set
Got 24

Notice that the howMany of 30 in my MetarEx calls was limited to the maximum value of 24 specified in the SetMaximumResultSize call, even though I requested a higher number.


#6

Thanks! This works really well now that I have a better idea of the form.

Matt P.