.NET MAUI › Networking & APIs

How do you call a REST API in MAUI?

Beginner

Answer

Use HttpClient (ideally via IHttpClientFactory) to send async requests, and System.Text.Json to deserialize responses. Always await calls off the UI thread and handle non-success status codes. Set base address and default headers once on the client.
var response = await _http.GetAsync("products");
response.EnsureSuccessStatusCode();
var products = await response.Content
    .ReadFromJsonAsync<List<Product>>();
Real-world example A catalog page loads products from a JSON API and binds them to a CollectionView.

Common follow-ups: Why use IHttpClientFactory? | How do you deserialize JSON?