I assume this is the same as we did before ASP.NET 5, so first you install the NuGet package for ASP.NET client libraries.
With this feature, you reference System.Net.Http:
using System.Net.Http;
Then you use it as follows:
using (var httpClient = new HttpClient()) { var response1 = await httpClient.GetAsync(url1); var response2 = await httpClient.PostAsync(url2); var response3 = await httpClient.SendAsync(url3); }
It just gives you the answer. Generally, you will want to examine the content, especially for GET requests. You can do it:
var content = await response1.Content.ReadAsStringAsync();
This just gives you a line in the content, so if it is JSON, you probably want to use something like JSON.NET (Newtonsoft.Json) to deserialize it into structured classes.
This is from memory, so you may need a little tweak here and there.
Gigi
source share