Results 1 to 8 of 8

Thread: [RESOLVED] HTTPrequest (POST) Request API key Error

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2011
    Posts
    42

    Resolved [RESOLVED] HTTPrequest (POST) Request API key Error

    I'm trying to obtain an API key via an HTTPrequest (POST).
    I'm using the “TEST server” data they provided.
    Their website API instructions are at :
    https://developer.estes-express.com/...kyNzc.#API-Key

    The example provided by the API folks is:Test example only:

    Code:
    curl -X POST 'https://uat-cloudapi.estes-express.com/v1/api-key'
    -H 'accept: application/json'
    -u ClientID:ClientSecret
    {redacted}'
    Basically it says if you send in the client-id and client-secret in the header the response will return the API key.
    I keep getting an error "401 Not Authorized” .

    My code is below. am I missing something?

    thanks

    -dan

    Code:
          Dim clientid As String = ("{redacted}")
           Dim clientsecret As String = ("{redacted}")
    
    
              Dim response As HttpWebResponse = Nothing
           Dim request As HttpWebRequest = CType(WebRequest.Create("https://uat-cloudapi.estes-express.com/v1/api-key"), HttpWebRequest)
    
           request.Method = ("POST")
           request.Accept = "application/json"
           request.Headers.Add(clientid, clientsecret)
    
           Try
               Dim httpResponse As System.Net.HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
               Dim sr As System.IO.StreamReader = New System.IO.StreamReader(httpResponse.GetResponseStream())
               sr.Close()
    
    
           Catch ex As WebException
               Dim errmsg As String = ex.Message
               If ex.Response IsNot Nothing Then
                   Dim httpResponse As HttpWebResponse = DirectCast(ex.Response, HttpWebResponse)
                   Console.WriteLine($"HTTP Error: {httpResponse.StatusCode} - {httpResponse.StatusDescription}")
    
               End If
    
           End Try
    Last edited by dday9; Oct 30th, 2025 at 08:19 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width