I can’t seem to figure out why the CXone Reporting API v2 returns an empty result set when querying agent state history for the last 24 hours.
The endpoint used is /api/v2/reporting/agents/states with the following OData filter: $filter=startTime gt 2024-05-20T00:00:00Z and startTime lt 2024-05-21T00:00:00Z. The request returns HTTP 200, but the items array in the JSON payload is empty.
I have verified that the user account has the necessary Analytics:View permissions and that agents were active during this window. The same query structure works for call volume metrics.
Is there a specific syntax requirement for time-based filters in the states endpoint that I am missing?
To fix this easily, this is to ensure the agent IDs are explicitly included in the request body, as the API requires specific agent identifiers rather than relying solely on the time filter.
Have you tried validating the OAuth scopes associated with your client credentials? The empty array often stems from insufficient permissions rather than syntax errors.
Verify the application has reporting:agent:view and reporting:conversation:view scopes.
Ensure the agent ID matches the format in the CXone directory, including any division prefixes if applicable.
Check the interval parameter. If set to PT1H, ensure the query window aligns perfectly with hour boundaries.
The official documentation states the interval parameter is critical for data aggregation. If you omit it or use an unsupported value, the engine returns an empty set rather than an error.
{
"interval": "PT15M",
"grouping": "agent"
}
Also verify the startTime is in UTC. My Paris timezone sync often fails when mixing local offsets with ISO strings.