Hi,
I'm trying to load up my request header but am havig zero luck
the example shows this
I've tried the code below and also some code using a webclient and Postasync functions.Code:When using our APIs and Web Services, you must pass the API Key using the /authenticate method to request a bearer token. For all customers, MyEstes credentials (MyEstes username and password) must be passed in the header. Test environment example: curl -X POST "https://uat-cloudapi.estes-express.com/authenticate" -H "accept: application/json" -H "apikey: 0101010101" The response JSON will contain the bearer token. (See JSON example on right.)
I keep getting the "UnAuthorized" respons/
I have to pass in my userid and password in the header and the APIkey as shown in the example.
Any help will be greatly appreciated.
Thanks
Code:Dim Username As String = ("MYUSER") Dim Password As String = ("MYPWD") Dim apikey As String = ("MYAPIKEY") Dim request As HttpWebRequest = CType(WebRequest.Create("https://uat-cloudapi.estes-express.com/authenticate"), HttpWebRequest) request.Method = "POST" request.Accept = "application/json" request.Headers.Add("Authorization", $"apikey:{apikey}") request.Headers.Add("Authorization", $"username:{Username}") request.Headers.Add("Authorization", $"passowrd:{Password}") Dim httpResponse As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse) Dim Returneddata As New StreamReader(httpResponse.GetResponseStream()) Dim RTNJSON As String = Returneddata.ReadToEnd() Dim JSONresponse = JsonConvert.DeserializeObject(Of HttpResponse)(RTNJSON)




Reply With Quote
