Struggling to discover what is wrong with my VB.net code
Dim user As String Dim pass As String user = "xxx" pass = "xxx" Dim request As WebRequest = WebRequest.Create("https://api.sm**k**s.com/v3/sessions/") request.Method = "POST" Dim postData As String postData = "{""username"": """ + user + """,""password"": """ + pass + """}" Dim byteArray As Byte() = System.Text.Encoding.UTF8.GetBytes(postData) request.ContentType = "application/json" request.ContentLength = byteArray.Length Dim dataStream As System.IO.Stream = request.GetRequestStream() dataStream.Write(byteArray, 0, byteArray.Length) dataStream.Close() Dim response As WebResponse = request.GetResponse()
I get a (401) unauthorized error. Ive tried asking on various forums but haven't received any useful responses. Any advice appreciated