Skip to content

Instantly share code, notes, and snippets.

View mikkelhm's full-sized avatar

Mikkel Holck Madsen mikkelhm

View GitHub Profile
@GeoffCox
GeoffCox / GitHubRestCall.cs
Last active December 10, 2020 23:24
Call GitHub REST API using HttpClient
WebRequestHandler handler = new WebRequestHandler()
{
UseProxy = true,
};
var client = new HttpClient(handler);
client.BaseAddress = new Uri("https://api.github.com/");
// You should set the version so that GitHub knows what API you area calling
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));