CXone Reporting API v2 agent state history query

Need to pull agent state history for the last 24 hours using the CXone Reporting API v2. The documentation is sparse on OData filters for this specific endpoint.

Here is the current request:

GET /api/v2/reporting/agents/{agentId}/statehistory

I am trying to filter by date, but the standard OData syntax isn’t working as expected. The response returns all states from the agent’s entire history, which is way too much data. I’ve tried appending $filter=timestamp ge 2023-10-27T00:00:00Z but get a 400 Bad Request. The error message says invalid filter syntax.

Is there a specific format for the timestamp? Or is this endpoint not fully OData compliant for date ranges? Any working examples would be appreciated.

Cause: The endpoint expects ISO 8601 format with timezone offsets. Omitting the ‘Z’ or a valid offset breaks the OData parser, causing the filter to be ignored.

Solution: Append the ‘Z’ suffix and ensure a strict date format. Here’s an example using the CXone Reporting API:

curl -X GET "https://reports.cxone.net/api/v2/reporting/agents/{agentId}/statehistory?$filter=timestamp ge 2023-10-27T00:00:00Z" -H "Authorization: Bearer <token>"

If issues persist, double-check the endpoint documentation for any specific timestamp requirements or limitations regarding OData filtering on agent state history.

1 Like