I checked every line and it matches my request in Postman, but I get a http 400 - bad request response in vb.net. Can some please help? below is an outline of the code:
Dim jsonPayload As String = JsonConvert.SerializeObject(payloadObject)
jsonPayload = "{ ““profile””: " + jsonPayload + “}”
Dim request As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
request.Method = “POST”
request.Headers.Add(“Authorization”, "SSWS " + apiToken)
request.ContentType = “application/json”
request.Accept = “application/json”
Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes(jsonPayload)
request.ContentLength = byteArray.Length
Using writer As Stream = request.GetRequestStream()
writer.Write(byteArray, 0, byteArray.Length)
End Using
Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse)
I get an error on the above line - {“The remote server returned an error: (400) Bad Request.”}