API Query

I need help with the structure of an API Query

Here is an example of one I tried:
url = URL(string:“https://flightxml.flightaware.com/json/AAL2586/MetarEx?airport=SAN&startTime=0&howMany=1&offset=0/BillKimball/**********KEY***********”)

below is the 410 response I received: The flight was current on my feeder!

Optional(<NSHTTPURLResponse: 0x6000015177e0> { URL: https://flightxml.flightaware.com/json/AAL2586/MetarEx?airport=SAN&startTime=0&howMany=1&offset=0/BillKimball/***************KEY*****} { Status Code: 410, Headers {
“Accept-Ranges” = (
bytes
);
Age = (
0
);
“Cache-Control” = (
“max-age=5, must-revalidate”
);
Connection = (
“keep-alive”
);
“Content-Length” = (
282
);
“Content-Type” = (
“text/html; charset=iso-8859-1”
);
Date = (
“Mon, 07 Mar 2022 01:38:17 GMT”
);
Server = (
“nginx/1.20.1”
);
“Strict-Transport-Security” = (
“max-age=31536000”
);
Via = (
“1.1 varnish”
);
“X-FA-Cache” = (
MISS
);
“X-Varnish” = (
2296620796
);
} })

Were you possibly meaning to use FlightInfoEx instead of MetarEx?

I tried it and I got a 401. Do I need my username Bill Kimball in it? What does 401 “unauthorized” mean. Thanks Bill

Hi Bill,

There are a few other things that need to be handled with regard to your initial query. One of our engineers will provide some further follow up here in just a bit.

Hi,

It looks like your API account is for the current version of AeroAPI (v4), but the URL construction indicates you’re trying to use some older AeroAPI v2 resources. This would contribute to the HTTP 410 (resource doesn’t exist) and HTTP 401 (not authenticated since the API key wasn’t valid in the context it was used in).

I’d encourage you to try out the interactive documentation for AeroAPI that can be found below. Any old “explorer” links should not be referenced for new users.
AeroAPI Developer Portal - FlightAware

If you enter your API key in the Authentication section it will allow you to make requests directly from that page. After trying a resource the interactive docs will also produce the curl command that demonstrates both the URL uses and how your API key was used to authenticate into the API.

For the MetarEx equivalent please see the resource GET /airports/{id}/weather/observations
For the FlightInfoEx equivalent please see the resource GET /flights/{ident}

Hi Dogrock,

I am an experienced programmer using Swift on Mac having had several Apps on the iPhone store
and I was able to create an App that got a response from AeroAPI query. I also have an R Pi feeder working. But Wow that developer portal is complex!

Could you please give me a lest of specific instructions ti get me through one Query, possibly GET /flights/{ident}

Thanks Bill

| dogrock FlightAware Staff
March 7 |

  • | - |

Hi,

It looks like your API account is for the current version of AeroAPI (v4), but the URL construction indicates you’re trying to use some older AeroAPI v2 resources. This would contribute to the HTTP 410 (resource doesn’t exist) and HTTP 401 (not authenticated since the API key wasn’t valid in the context it was used in).

I’d encourage you to try out the interactive documentation for AeroAPI that can be found below. Any old “explorer” links should not be referenced for new users.
AeroAPI Developer Portal - FlightAware

If you enter your API key in the Authentication section it will allow you to make requests directly from that page. After trying a resource the interactive docs will also produce the curl command that demonstrates both the URL uses and how your API key was used to authenticate into the API.

For the MetarEx equivalent please see the resource GET /airports/{id}/weather/observations
For the FlightInfoEx equivalent please see the resource GET /flights/{ident}

  1. Set x-apikey HTTP header to your AeroAPI key found at AeroAPI Developer Portal - FlightAware
  2. Send GET request to https://aeroapi.flightaware.com/aeroapi/flights/{ident} where {ident} is the ident or tail of your choice.

Can you tell me exactly what this URL string needs to work. It gets a 410 response Code.

https://flightxml.flightaware.com/json/AAL1591/FlightInfoEx?airport=SAN/BillKimball/** key **”

If you can’t do that, can you send me a complete working request string that will get a 200 code and return an aircraft location - Please

Bill

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.