mixing
Regular Member
- Jan 18, 2014
- 412
- 63
I'm trying to send a CURL request, but appear to be having some issues with my header and hope someone can help...
Here is my code:
This looks to me like it should work, but I keep getting an exception:
THREAD EXCEPTION at 4:05:33 AM with error: Specified value does not have a ':' separator.
Code:
curl -u 'myusername-test:1815dff0d321430378567bc84963ecd06f71d10f' 'https://api.dev.thewebsite.com/v4/domains' -X POST -H 'Content-Type: application/json' --data '{"domain":{"domainName":"example.org"},"purchasePrice":12.99}'
Here is my code:
Code:
Try
Dim myReq As HttpWebRequest
Dim myResp As HttpWebResponse
Dim myUsername As String = "myusername-test:1815dff0d321430378567bc84963ecd06f71d10f"
myReq = HttpWebRequest.Create("https://api.dev.thewebsite.com/v4/domains")
myReq.Method = "POST"
myReq.ContentType = "application/json"
myReq.Headers.Add(myUsername)
Dim myData As String = "{""domain"":{""domainName"":""example.org""},""purchasePrice"":12.99}"
myReq.GetRequestStream.Write(System.Text.Encoding.UTF8.GetBytes(myData), 0, System.Text.Encoding.UTF8.GetBytes(myData).Count)
myResp = myReq.GetResponse
Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
WebResponse = myreader.ReadToEnd
Catch ex As Exception
txtLog.AppendText("THREAD EXCEPTION at " & TimeOfDay & " with error: " & ex.Message & vbCrLf)
End Try
This looks to me like it should work, but I keep getting an exception:
THREAD EXCEPTION at 4:05:33 AM with error: Specified value does not have a ':' separator.