HTTP Error Code: 401 Authorization Required

Dear Support,

I am making following query but getting the error Authorization Required.

name:password@flightxml.flightaw … 1&offset=0

Can you guide me for the possible problems?

Please note that I am working on behalf of my client.

Thanks,

Be sure that you are supplying a FlightXML API key and not your website user password in the request.

Dear Support,

Thanks for your reply. You mean that the user name will be the website user name but the password will not be website password but FlightXML API key.

Am I right?

Thanks,

Affirmative. You may request a key from here if you haven’t already: flightaware.com/commercial/flightxml/key

Dear Support,

I am still getting the ‘Authorization Required’ message. This time I have provided a valid user name and API key in the following form:

name:API_KEY@flightxml.flightawa … 1&offset=0

Am I still making some mistake?

Thanks,

Your URL does work, so it’s possible you have some slight copy/paste error in the username or API Key. Try starting with one of the example programs provided on the documentation page and modifying just the credentials. Supplying the username and your API Key should be all you need to change.

Dear Support,

I am making a REST based Java program for utilizing the Flight Aware service so I think the following URL will be wrong:

name:API_KEY@flightxml.flightawa … 1&offset=0

I will need to do some encoding for name and API key. Am I right?

How can I do this using the JDK only i.e. not using any third party library?

Thanks,

We do not provide sample code for accessing our REST/JSON interface from Java, however it is fairly simple to write. You will need to make sure that the requests are being generated in a way that meets our servers’ expectations and that the HTTP authentication is properly formatted.

Alternatively you can use our SOAP/XML interface and use the Apache Axis library sample code that we provide on our documentation website.