=============================================
C# Grafana api client
var uri = new Uri("http://localhost:3000/");
//grafana configurations /org/apikeys
var apiKey = "....";
var annotationService = new AnnotationService(uri, apiKey);
var dashboardService = new DashboardService(uri, apiKey);
//find dashboard id
//Uid may be edited in dashboard settings
var dashboardResponse = dashboardService.GetDashboardByUid("test_dashboard");
var dashboardId = dashboardResponse.Dashboard.Id;
//Epoch datetime in milliseconds
var start = DateTime.UtcNow.AddMinutes(-15).ToGrafanaTimestamp();
//Epoch datetime in milliseconds
var stop = DateTime.UtcNow.ToGrafanaTimestamp();
//create annotation
annotationService.Create(new CreateAnnotationRequest
{
DashboardId = dashboardId,
IsRegion = true,
Tags = new[] {"deploy", Environment.MachineName },
Text = $"Deploy on {Environment.MachineName}",
Time = start,
TimeEnd = stop
});