try
{
using HttpResponseMessage response = await client.GetAsync("https://dummyjson.com/products?limit=20");
string responseBody = await response.Content.ReadAsStringAsync();
GetProductsResponse obj = Newtonsoft.Json.JsonConvert.DeserializeObject< GetProductsResponse>(responseBody);
ProductsCollection.ItemsSource = obj.Products;
}
catch(HttpRequestException ex)
{
await Shell.Current.DisplayAlert($"Error {(int)(ex.StatusCode ?? System.Net.HttpStatusCode.OK)}", ex.Message, "Oh snap!");
}
catch (Exception ex)
{
await Shell.Current.DisplayAlert($"Unknown Error", ex.Message, "Oh snap!");
}
-
Notifications
You must be signed in to change notification settings - Fork 0
License
Naxilos/httpclient-demo
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published