Reputation: 39
I try to get data from external API with blazor WASM but i've got exception: "TypeError: NetworkError when attempting to fetch resource" My code is like belowe. Coulde someone tell me what should i do to get this data? Thank you in advance.
public class Rate
{
public string no { get; set; }
public string effectiveDate { get; set; }
public double mid { get; set; }
}
public class Nbp
{
public string table { get; set; }
public string currency { get; set; }
public string code { get; set; }
public Rate[] rates { get; set; }
}
//...
var test = await Http.GetFromJsonAsync<Nbp>("http://api.nbp.pl/api/exchangerates/rates/A/EUR/2020-12-15/?format=json");
Upvotes: 1
Views: 841
Reputation: 14573
Change your request to https
.
var test = await Http.GetFromJsonAsync<Nbp>("https://api.nbp.pl/api/exchangerates/rates/A/EUR/2020-12-15/?format=json");
Upvotes: 1