In the Blazor client-side application, you can call the web APIs using HttpClient service. In the following code, the GetData API is called on button click event. The GetFromJsonAsync method is used to get the parsed Json data.
@inject HttpClient Httpclient
<button @onclick="@GetData">Get Data</button>
@code {
private async Task GetData()
{
await Httpclient.GetFromJsonAsync<T>("api/GetData");
}
}
Share with