Hey folks,
I’m trying to construct an Analytics API aggregation query that groups call metrics by both queue and media type. The goal is to get a breakdown of handled calls for voice vs. chat across specific queues in our hybrid setup. I’ve been staring at the documentation for /api/v2/analytics/details and trying to piece together the correct groupBy structure, but the response keeps coming back with zero data or malformed group keys.
Here is what I have so far:
- Endpoint:
GET /api/v2/analytics/details - Interval:
5min - Date Range: Last 24 hours
- Metrics:
handled,abandoned - Group By:
queue,mediaType
My current JSON payload for the request body looks like this:
{
"interval": "5min",
"dateFrom": "2023-10-25T00:00:00.000Z",
"dateTo": "2023-10-26T00:00:00.000Z",
"groupBy": ["queue", "mediaType"],
"metrics": {
"voice": {
"handled": "sum"
}
}
}
The API accepts the request without a 400 error, but the returned intervals array is empty. If I remove mediaType from groupBy, I get data for the queues. If I remove queue, I get data for media types. But combining them seems to break the aggregation.
I’ve tried swapping the order in the groupBy array, but that didn’t help. I also checked the view parameter and made sure I’m using default instead of agent or supervisor, since this is a system-wide query.
Is there a specific way to nest the metrics when grouping by multiple dimensions? Or am I missing a required filter for the media type to align with the queue data? The documentation is a bit vague on multi-dimensional grouping examples.
Any pointers on the correct payload structure would be appreciated. I’m just trying to get this report to populate so I can feed it into our dashboard.