# HTTP request is unauthorized

**URL:** <https://discussions.flightaware.com/t/http-request-is-unauthorized/46184>\
**Category:** AeroAPI\
**Created:** [February 22, 2019, 3:38am UTC](https://discussions.flightaware.com/t/http-request-is-unauthorized/46184 "2019-02-22T03:38:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JeffKincaid](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/jeffkincaid/32/33240_2.png) [@JeffKincaid](https://discussions.flightaware.com/u/JeffKincaid)\
**Post date:** [February 22, 2019, 3:38am UTC](https://discussions.flightaware.com/t/http-request-is-unauthorized/46184/1 "2019-02-22T03:38:12Z")

</div>

Can someone please help me get started using the FlightXML2 API.

I have read all of the examples and followed the instructions. I’m using Visual Studio 2017, C#. I created a new project. I created a service reference called FlightXML2

FlightXML2.FlightXML2SoapClient client = new FlightXML2.FlightXML2SoapClient();  
client.ClientCredentials.UserName.UserName = “???”;  
client.ClientCredentials.UserName.Password = “???”;  
int ret = client.RegisterAlertEndpoint(???", “json/post”);

I’m using my user ID and API key, and when I execute the first command RegisterAlertEndpoint I get the error.

System.ServiceModel.Security.MessageSecurityException: ‘The HTTP request is unauthorized with client authentication scheme ‘Anonymous’. The authentication header received from the server was ‘Basic realm=“FlightXML2”’.’

I have also tried to generate a class using wsdl.exe /out:c:\fa\FlightXML2.cs [http://flightxml.flightaware.com/soap/FlightXML2/wsdl](http://flightxml.flightaware.com/soap/FlightXML2/wsdl), and include the class in my project but it does not work.

Please let me know what to do.

Thanks for you assistance.  
Jeff

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [February 26, 2019, 9:14pm UTC](https://discussions.flightaware.com/t/http-request-is-unauthorized/46184/2 "2019-02-26T21:14:25Z")

</div>

Be sure you’re supplying the API key as the password, and not your website password. Try starting out with a simpler FlightXML function, such as one made by our stock example code, rather than something as complex as RegisterAlertEndpoint.
