我需要在VB.net上编写这个Curl / json命令。我不知道如何使用HttpWebRequest。请帮助!!!
curl -X GET --header"接受: / " --header" X-Auth-Token:eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NTc3NTQ1" " http://staging-exact-integration.posios.com/PosServer/rest/core/company"
答案 0 :(得分:1)
HttpClient就是您追求的目标。
要添加标题,您只需创建自定义HttpRequestMessage:
Dim client As New HttpClient()
Dim request As New HttpRequestMessage() With
{
.RequestUri = New Uri("http://staging-exact-integration.posios.com/PosServer/rest/core/company"),
.Method = HttpMethod.Get,
}
request.Headers.Add("X-Auth-Token", "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NTc3NTQ1")
Dim result = client.SendAsync(request).Result