API : vb.net : 'The remote server returned an error: (403) Forbidden.'

Hey all ! 

I'm having an issue that I cannot seem to find the solution for.. 


   Dim uristring As String = "https://DOMAIN.freshservice.com/api/v2/tickets/" & tb_ticketno.Text.ToString & "/requested_items.json"
        Dim uri As New Uri(uristring)

        'make http request 
        Dim KeyString As Byte() = System.Text.Encoding.UTF8.GetBytes("XXXX-APIKEY-XXXX")
        Dim EncodedKey = Convert.ToBase64String(KeyString)

        Dim request As HttpWebRequest = HttpWebRequest.Create(uri)
        request.Headers.Add("Authorization", "Basic" & EncodedKey)
        request.ContentType = "application/json"
        request.PreAuthenticate = True
        request.Method = "GET"

        'get http response 
        Dim response As HttpWebResponse = request.GetResponse


Any help would be very useful!

Login or Signup to post a comment