Analytics API aggregation query grouping by queue and media type returns empty result

Running into a weird issue with the Analytics API. I’m trying to build a report that aggregates conversation data grouped by both queue and media type. I’m using the async aggregates query flow, submitting a job and then fetching the results via GET /api/v2/analytics/conversations/aggregates/jobs/{jobId}/results.

I’ve been staring at the docs and my code for an hour. The job completes successfully, no 400s or 500s. But the response body is just {"results": []}. Empty. Every time.

Here’s the JSON payload I’m sending in the request body to initiate the job:

{
 "groupings": [
 {
 "type": "attribute",
 "attribute": "queue.id",
 "valueType": "string"
 },
 {
 "type": "attribute",
 "attribute": "mediaType",
 "valueType": "string"
 }
 ],
 "interval": "2023-10-01T00:00:00Z/2023-10-02T00:00:00Z",
 "metrics": [
 "conversationCount",
 "handledCount"
 ]
}

I’ve tried swapping mediaType for media.type and conversation.mediaType. Nothing. I’ve checked the queue IDs. They exist. There was definitely traffic in that window. I even tried removing the grouping by media type, and then I get data for the queues. So the queue grouping works. It’s just the combination that kills it.

Is there a specific syntax for multi-dimensional groupings in this endpoint? The docs show examples with a single grouping, but nothing about stacking them. I feel like I’m missing a subtle flag or a required filter.

Also, just to be sure, I’m using the Python SDK to submit the job and fetch the results. It wraps the HTTP call, but I’ve verified the raw request via Postman too. Same result. Empty list.

Anyone seen this before? Feels like a bug, but I doubt it is. Probably just me missing something obvious again.

The endpoint doesn’t accept a body. Use query parameters. You’re likely missing the groupBy parameter or the date range.

GET /api/v2/analytics/conversations/aggregates/jobs/{jobId}/results?cursor=...

Check the interval too. Default is often too wide for empty queues.

Query parameters are fine, but if you’re still getting empty results, the date range is bably the culprit. Analytics data isn’t real-time. There’s a lag. If you’re querying from and to dates that are in the last few hours, you’ll get nothing.

Try shifting your window back by at least 24 hours. Also, check if the queues you’re targeting actually had traffic during that specific interval. If a queue is idle, it won’t appear in the summary unless you force it, which the API doesn’t really do for this endpoint.

Here’s a safer curl example using a known busy period:

# Use an analytics aggregate query to fetch queue data
curl -X POST "https://api.mypurecloud.com/api/v2/analytics/conversations/aggregates/query" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
  "interval": "2023-09-01T00:00:00.000Z/2023-09-02T00:00:00.000Z",
  "groupBy": ["queue", "mediaType"]
}'

The analytics engine aggregates in batches. Don’t expect instant gratification. Check the metrics field in the response too. Sometimes it’s not empty, just zeroed out if no metrics were selected.

2 Likes