1

I need to code this Curl/json command on VB.net. I am not sure how to use HttpWebRequest. Please HELP!!!

curl -X GET --header "Accept: /" --header "X-Auth-Token: eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0NTc3NTQ1" "http://staging-exact-integration.posios.com/PosServer/rest/core/company"

1

1 Answer 1

1

HttpClient is what you're after.

To add headers, you simply create a custom 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
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks "Uno" it looks like is taking the token now. What I need to do now is to save the results on a json format and show them somehow.I will appreciate some help!!!
No problem ;). The result will be a HttpResponseMessage, and result.Content.ReadAsStringAsync should give you back the JSON data as a string.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.