XML only getting 15 results after JSONSerialization


#1

Hello, could anybody help me to figure out what I am missing. I am using the following code >>NSString *requestString = [NSString stringWithFormat:@“http://username:apiKey@flightxml.flightaware.com/json/FlightXML2/Enroute?airport=ORD&filter=’’&howMany=100&SetMaximumResultSize?max_size=60”];
NSURLSessionConfiguration *config = [NSURLSessionConfiguration ephemeralSessionConfiguration];
config.HTTPAdditionalHeaders = @{ @“Accept”:@“application/json”};
NSURLSession *urlSession = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil];

NSURL *url = [NSURL URLWithString:requestString];
NSURLRequest *req = [NSURLRequest requestWithURL:url];

NSURLSessionDataTask *dataTask = [urlSession dataTaskWithRequest:req completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    
    NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
    NSLog(@"jsonObject is %@",jsonObject);
}];

[dataTask resume];

I NEED TO RETREIVE ALL THE FLIGHTS THAT ARE ARRIVING TO OHARE INTERNATIONAL AIRPORT.


#2

You need to call SetMaximumResultSize once on your account in order to opt-in for more than 15 results.


#3

Do you mind sharing how to call SetMaximumResultSize? thank you sir


#4

The documentation for that function is here:
flightxml.flightaware.com/soap/ … ResultSize


#5

The problem is that i am using in Objective C, iOS platform. And the documentation does not provide anything related to Objective c XCODE.


#6

I’ve tried to call using this link username:apiKey@flightxml.flight … x_size=100
but unfortunately still no luck>>>


#7

I HAVE SOLVED IT WITH THE FOLLOWING LINK username:apiKey@flightxml.flight … &offset=10> THANK YOU FOR YOUR HELP


#8

Good to hear that you’ve got it working, but I’d like to just mention that your prior link seems to have multiple question marks in it and seems to incorrectly combine an “Enroute” request with a “SetMaximumResultSize” request in a single URL. They need to be issued as separate requests, such as this once:


http://username:apiKey@flightxml.flightaware.com/json/FlightXML2/SetMaximumResultSize?max_size=100

And then…


http://username:apiKey@flightxml.flightaware.com/json/FlightXML2/Enroute?airport=KORD&howMany=50&offset=0

Also try to use 4-letter (ICAO) airport codes when possible (KORD vs ORD). We sometimes are able to automatically convert such inputs, but it cannot be reliably done in all cases.