Skip to content

Instantly share code, notes, and snippets.

@IamTails
Created May 1, 2018 02:37
Show Gist options
  • Save IamTails/5df3cb9d8860e85fe9c183a58ce9d47f to your computer and use it in GitHub Desktop.
Save IamTails/5df3cb9d8860e85fe9c183a58ce9d47f to your computer and use it in GitHub Desktop.
C# get
namespace Test
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Making API Call...");
using (var client = new HttpClient(new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate }))
{
client.BaseAddress = new Uri("https://nekos.life/api/v2/img/");
HttpResponseMessage response = client.GetAsync("neko").Result;
response.EnsureSuccessStatusCode();
string result = response.Content.ReadAsStringAsync().Result;
Console.WriteLine("Result: " + result);
}
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment