An open API service indexing awesome lists of open source software.

https://github.com/totaro/httpclientdemoapp

HttpClient REST API calls - C# ASP.NET MVC Blazor/Razor pages - Demo Hub for different coding experiments: HttpClientDemo
https://github.com/totaro/httpclientdemoapp

asp-net asp-net-mvc csharp httpclient razor-pages rest-api

Last synced: 1 day ago
JSON representation

HttpClient REST API calls - C# ASP.NET MVC Blazor/Razor pages - Demo Hub for different coding experiments: HttpClientDemo

Awesome Lists containing this project

README

          

# HttpClientDemoApp
Demo Hub for different coding experiments: HttpClientDemo

C#/ASP.NET MVC Blazor/Razor pages

.NET 6.0 framework
using NuGet Package: System.Net.Http.Json 6.0.0

HttpClient REST API for 2 different calls:

- 5 days weatherforecast (weather state, daily low/high degrees) for Helsinki, Finland from https://www.metaweather.com/api/location/565346/

Models:
\HttpClientDemo\Models\WeatherForecastModel.cs
\HttpClientDemo\Models\DayForecastModel.cs

Page/HttpClient:
\HttpClientDemo\Pages\WeatherData.razor (try..catch response)

BaseAddress configuration for weatherdata (\HttpClientDemo\Startup.cs)

string uri = Configuration.GetValue("MetaAPI");
services.AddHttpClient("meta", c =>
{
c.BaseAddress = new Uri(uri);
});

BaseAddress name configuration (\HttpClientDemo\appsettings.json)
"MetaAPI": "https://www.metaweather.com/api/"

-------------------------------------------------------------------------------------

- Current Bitcoin value (Euro, USD, GBP and JPY) currencies with 24 hours volume and change from https://api.coingecko.com/api/

Model:
\HttpClientDemo\Models\CryptoCurrentModel.cs

Page/HttpClient:
\HttpClientDemo\Pages\CryptoData.razor (if..else response)