Zest.

C#: HTTP GET with HttpClient

A short, tested C# example for http get with httpclient. Copy it and adjust the names and paths for your project.

C#
using var http = new HttpClient();
var items = await http.GetFromJsonAsync<List<Item>>("https://api.example.com/items");

var res = await http.PostAsJsonAsync("https://api.example.com/items", new { name = "zest" });
res.EnsureSuccessStatusCode();

Find it in Zest

Search for “csharp http get with httpclient” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.

More C# examples

All C# examples