Trying to pull agent utilization metrics (tHandle, tAcw, tHold) broken down by 30-minute intervals. The goal is to feed this into an Azure Function that calculates real-time efficiency scores.
I’m using the .NET SDK (PureCloudPlatform.Client.V2). The docs say GetAnalyticsQueuesAgentSummary supports interval, but I’m getting a 400 Bad Request when I set it to PT30M.
Here’s the snippet:
var api = new AnalyticsApi();
var request = new GetAnalyticsQueuesAgentSummaryRequest
{
AgentId = "550e8400-e29b-41d4-a716-446655440000",
DateFrom = "2023-10-27T12:00:00Z",
DateTo = "2023-10-27T13:00:00Z",
Interval = "PT30M",
MetricNames = new List<string> { "tHandle", "tAcw", "tHold" }
};
try
{
var response = await api.GetAnalyticsQueuesAgentSummary(request);
}
catch (ApiException ex)
{
Console.WriteLine(ex.Message);
}
The error payload comes back like this:
{
"code": "bad.request",
"message": "Invalid interval value: PT30M. Supported intervals: PT1H, PT4H, PT1D."
}
Wait, the docs also mention GetAnalyticsQueuesAgentDetail. I tried that endpoint instead. No 400 error this time. But the response only has one row per agent, not split by interval. The metricValues are just aggregated totals for the whole hour.
I need the data sliced up. Is there a different endpoint? Or am I missing a query param like groupBy? I tried adding GroupBy = new List<string> { "interval" } to the request object, but the SDK doesn’t seem to expose that property for the summary call.
Also, timezone is America/Sao_Paulo. Does the API expect UTC for DateFrom? I’ve been sending Zulu time.
Anyone got this working with the .NET client? The Java examples in the docs look different.