Trying to pull agent state history for the last 24 hours using the CXone Reporting API. I’m hitting GET /api/v2/analytics/agents/summary with the following query parameters:
query={
"select": [
{
"name": "agent.id",
"id": "agent_id"
},
{
"name": "agent.state",
"id": "agent_state"
},
{
"name": "interval",
"id": "interval"
}
],
"where": [
{
"type": "timeRange",
"metric": "interval",
"from": "2023-10-25T00:00:00-05:00",
"to": "2023-10-26T00:00:00-05:00"
}
],
"groupBy": [
"agent_id",
"interval",
"agent_state"
],
"interval": "15m"
}
The request returns a 200 OK but the results array is empty. I’ve verified the from and to timestamps are in ISO 8601 format with the correct America/Chicago offset. The agent ID is correct and the agent was definitely logged in during this window.
I’ve tried removing the groupBy on agent_state and just grouping by agent_id and interval, but still get no data. Is there a specific permission needed for agent state metrics? Or is the agent.state metric name incorrect? The docs list it as agent.state but maybe it’s case sensitive or aliased differently in the OData layer.
Using Kotlin with OkHttp for the requests. Here’s the relevant part of the client setup:
val client = OkHttpClient.Builder()
.addInterceptor { chain ->
val request = chain.request().newBuilder()
.addHeader("Authorization", "Bearer $token")
.addHeader("Content-Type", "application/json")
.build()
chain.proceed(request)
}
.build()
Token is fresh and valid. Other reporting endpoints like conversations/summary work fine with the same token and client. Feels like a metric availability issue or a subtle syntax error in the query string encoding. Checked the URL encoding manually and it looks correct. Anyone seen this before?