I’m building a custom reporting tool for our team using the Genesys Cloud Analytics API. The goal is to calculate the Service Level percentage for a specific queue based on raw interval data. I’m using the /api/v2/analytics/queues/summary endpoint with the interval parameter set to PT1H.
The response includes serviceLevel objects, but I’m confused about how to interpret the percent field versus the count fields. Here is a sample response:
{
"serviceLevel": {
"percent": 0.85,
"count": 120,
"targetCount": 100
}
}
I assumed percent is the SLA achievement. But when I sum up the count values for all intervals and divide by the total calls, the number doesn’t match the percent value in the UI. The UI shows 85% SLA, but my calculation gives me 78%.
Here is my calculation logic in C#:
var totalCalls = intervals.Sum(i => i.serviceLevel.count);
var totalTargeted = intervals.Sum(i => i.serviceLevel.targetCount);
var calculatedSLA = (double)totalTargeted / totalCalls;
The calculatedSLA is 0.78. Why is there a discrepancy? Is the API returning pre-aggregated percentages that shouldn’t be summed? Or am I missing a weighting factor? I’ve checked the documentation but it’s not clear how to derive the overall SLA from interval data.