Struggling to figure out why my calculated Service Level percentage diverges significantly from the dashboard metrics when processing raw interval data from the Analytics API. I am building a Next.js server component that fetches queue performance data via the analyticsQueryQueues method from the Genesys Cloud Platform SDK for JavaScript. The environment is Node.js v18.17 with @genesys/cloud/genesys-cloud-sdk 2.1.0.
I am querying /api/v2/analytics/queues/queues with a 15-minute interval. My logic sums the offeredCount and answeredInSLCount across all intervals for the day. However, the result is consistently 15% lower than the official report. Here is the aggregation logic:
const totalOffered = intervals.reduce((acc, curr) => acc + (curr.offeredCount || 0), 0);
const totalAnswered = intervals.reduce((acc, curr) => acc + (curr.answeredInSLCount || 0), 0);
const calculatedSL = (totalAnswered / totalOffered) * 100;
The API response returns valid JSON with no HTTP errors. Am I missing a specific filter in the request body, or is the answeredInSLCount field not directly summable across intervals due to partial interval handling? How should I properly aggregate this data to match the platform’s reporting engine?