We are building a backend service to fetch Genesys Cloud recording metadata for New Relic dashboards. The goal is to automate the token retrieval using the client_credentials grant type so we don’t have to manually refresh tokens every hour.
The current implementation uses the Genesys Cloud Python SDK to call the analytics API. We need to query agent utilization metrics, specifically tHandle, tAcw, and tHold, broken down by 30-minute intervals.
Here is the Python code snippet we are using:
from genesyscloud import analytics_api
from genesyscloud.analytics.model import QuerySplitMetricsRequest
analytics = analytics_api.AnalyticsApi(api_client)
request_body = QuerySplitMetricsRequest(
metric_names=['tHandle', 'tAcw', 'tHold'],
group_by=['interval'],
interval='30min',
date_from='2024-01-01T00:00:00.000Z',
date_to='2024-01-01T01:00:00.000Z'
)
response = analytics.post_analytics_agents_utilization_query(request_body=request_body)
The API call returns a 400 Bad Request error with the following message:
{
"code": "badRequest",
"message": "Invalid group_by value: interval is not supported for this metric type.",
"status": 400
}
We’ve tried changing the group_by to agentId and queueId, but the 30-minute interval breakdown is critical for our New Relic dashboards. Is there a different API endpoint or a specific configuration required to get these metrics at a 30-minute granularity?
Thanks in advance for any help.