CXone Reporting API v2 Agent State History OData Query Structure

refactoring our internal dashboard to pull real-time agent state history for the last 24 hours from the NICE CXone platform. The objective is to correlate specific idle durations with subsequent handling times, requiring a granular view of state transitions. We are attempting to use the Reporting API v2 endpoint specifically designed for this data, which appears to be /api/v2/reporting/agent-statistics. The documentation suggests that OData query parameters should be used to filter the results, but the behavior of the $filter parameter in this specific context seems inconsistent with our expectations.

Here is the current structure of the GET request we are constructing in our Python automation script:

GET /api/v2/reporting/agent-statistics?$filter=startTime ge 2023-10-25T00:00:00Z and endTime le 2023-10-26T00:00:00Z&interval=PT1H&metrics=stateHistory

The issue arises when we attempt to filter by a specific agent ID within the same request. When we append and agentId eq '12345678-1234-1234-1234-123456789012' to the filter string, the API returns a 200 OK status, but the resulting JSON payload contains an empty array for the results field. This occurs despite confirming that the agent was active during the specified window. The response body looks like this:

{
 "totalCount": 0,
 "results": []
}

We have verified the agent ID format and the timezone alignment, ensuring that the UTC timestamps cover the correct Berlin local time window. It seems that the stateHistory metric might require a different query structure or that the OData filter syntax for nested objects is not being applied correctly. We are wondering if there is a known limitation when combining time-range filters with agent-specific filters in a single call. Perhaps a separate endpoint or a different pagination strategy is required to retrieve this specific subset of data without hitting the empty result set. Any insights into the correct OData syntax for this metric would be appreciated.