Skip to content

Instantly share code, notes, and snippets.

@dan0nchik
Created June 30, 2020 09:34
Show Gist options
  • Save dan0nchik/cb940732602b852a65984b3c887b9cce to your computer and use it in GitHub Desktop.
Save dan0nchik/cb940732602b852a65984b3c887b9cce to your computer and use it in GitHub Desktop.
Get request in ASP.NET core
WebRequest request = WebRequest.Create("https://api.thecatapi.com/v1/categories");
using (var s = request.GetResponse().GetResponseStream())
{
using (var sr = new StreamReader(s))
{
var asJSON = sr.ReadToEnd();
res = JsonConvert.DeserializeObject<List<CategoriesModel>>(asJSON);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment