// In production code, don't destroy the HttpClient through using, but better use IHttpClientFactory factory or at least reuse an existing HttpClient instance
// https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests
// https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.tggl.io/flags"))
{
request.Headers.TryAddWithoutValidation("x-tggl-api-key", "<API_KEY>");
request.Content = new StringContent("{\"userId\":\"foo\",\"email\":\"foo@gmail.com\"}");
request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
var response = await httpClient.SendAsync(request);
}
}
Empower product and marketing teams to experiment within safe boundaries set by your engineering team.
Your app is instantly updated when a flag is updated, no need to write code and deploy the new version.