Hey everyone,
I’m trying to pull some adherence data for our Chicago team using the Analytics API. The goal is to get a breakdown of handle times grouped by queue and media type. I’m using the Python SDK because it handles the pagination nicely, but I’m stuck on the aggregation part.
Here’s what I have so far:
from genesyscloud import analytics_api
api_instance = analytics_api.AnalyticsApi(api_client)
body = {
"groupBy": ["queueId", "mediaType"],
"interval": "P1D",
"queryFilter": {
"type": "and",
"clauses": [
{
"dimension": "queueId",
"operator": "in",
"value": ["queue_id_1", "queue_id_2"]
}
]
},
"size": 100
}
try:
result = api_instance.post_analytics_queues_metrics_query(body=body)
print(result)
except Exception as e:
print(f"Exception when calling AnalyticsApi->post_analytics_queues_metrics_query: {e}")
The code runs without errors, but the response doesn’t seem to group the data correctly. Instead of getting separate entries for each queue and media type combination, I’m getting a flat list. I’ve tried tweaking the groupBy array and the queryFilter, but nothing changes the output structure.
I’m following the docs on Aggregation Queries, but I’m not sure if I’m missing something obvious. Does the groupBy parameter work differently for queue metrics compared to other analytics endpoints? Or is there a specific way to structure the queryFilter to ensure proper grouping?
Any help would be appreciated. I’ve been staring at this for a while now, and it’s driving me nuts. I just want to see the data broken down by queue and media type so I can analyze our team’s performance better.