Hi, i got this error message when i tried to submit parameters to endpoint url.
API Provider request the following
Request Authorization Header(Basic Auth)
Username ABC12345
Password {leave blank}
The following is my coding:
Dim Username As String = "ABC123"
Dim Password As String = ""
Dim svcCredentials As String = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(Username & ":" & Password))
Dim inputJson As String = (New JavaScriptSerializer()).Serialize(inputData)
ServicePointManager.Expect100Continue = True
ServicePointManager.SecurityProtocol = CType(3072, SecurityProtocolType)
Dim httpRequest As HttpWebRequest = DirectCast(WebRequest.Create(New Uri(EndpointUrl)), HttpWebRequest)
Request.Headers.Add("Authorization", "Basic " & svcCredentials)
httpRequest.Accept = "application/json"
httpRequest.ContentType = "application/json"
httpRequest.Method = "POST"
Dim bytes As Byte() = Encoding.UTF8.GetBytes(inputJson)
Using stream As Stream = httpRequest.GetRequestStream()
stream.Write(bytes, 0, bytes.Length)
stream.Close()
End Using