Noob playing with the API, getting 401 Authorization Required


#1

I’m not a great programmer, and most of my experience using APIs is through webhooks in Zapier. I’m working on a little project to look up data about my past flights, and wanted to explore if I could use the V3 FlightXML API for my needs.

I figured I’d try to see if I could get it working just using https://www.hurl.it/ to begin with, but I’m having issues with the Auth.

I’m using my site username and the V3 API key for the Basic Auth, and Hurl.it is sending it Base64 encoded, still I’m getting this response:

Accept-Ranges: bytes

Access-Control-Allow-Credentials: true

Access-Control-Allow-Methods: POST, GET

Access-Control-Allow-Origin: *

Access-Control-Max-Age: 1728000

Age: 0

Cache-Control: max-age=5, must-revalidate

Connection: keep-alive

Content-Encoding: gzip

Content-Length: 182

Content-Type: text/html;charset=utf-8

Date: Wed, 25 Apr 2018 10:08:35 GMT

Server: FlightAware/3.1

Strict-Transport-Security: max-age=31536000

Vary: Accept-Encoding

Via: 1.1 varnish

Www-Authenticate: Basic realm="FlightXML2"

X-Fa-Cache: MISS

X-Varnish: 520326335

BODY

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <title>Authentication Required</title>
  </head>
  <body>
    <h1>Authentication Required</h1>
  </body>
</html>

Any idea why it’s not working?

EDIT: Here’s the request being sent: http://c.thomas.do/r92M


#2

On the surface, it appears you are making a FlightXML2 call with a FlightXML3 Beta key. You should use the FlightXML3 Beta methods.


#3

Thanks @cbw, I’ll give that a shot.

I just copied the example from the v3 documentation:

Is the v3 documentation not up to date?


#4

Those URLs should say /json/FlightXML3/METHODNAME instead. An update will be made to that page tomorrow.