Trying to pull agent state history for the last 24 hours using the CXone Reporting API v2. I’ve got the OAuth token sorted, but the query keeps failing when I try to filter by a specific date range.
Here’s the endpoint I’m hitting:
GET /api/v2/analytics/queues/summary?metric=agent-state-history&interval=PT1H
I’m adding these query params:
dateFrom:2023-10-25T00:00:00.000ZdateTo:2023-10-26T00:00:00.000Z
The response comes back with a 400 Bad Request. The error message is vague: "Invalid query parameters".
I’ve tried:
- Using ISO 8601 format for dates.
- Changing the interval to
PT1M. - Removing the
dateFrom/dateToparams and just usinginterval. This works, but I can’t filter for a specific 24-hour window.
The docs say dateFrom and dateTo are optional, but if I don’t provide them, I get data for the default period, which isn’t what I need. I need exactly the last 24 hours.
Am I missing something in the query structure? The agent-state-history metric seems to behave differently than other metrics like queue-handle-time.
Here’s a of the Python code I’m using:
params = {
"metric": "agent-state-history",
"interval": "PT1H",
"dateFrom": "2023-10-25T00:00:00.000Z",
"dateTo": "2023-10-26T00:00:00.000Z"
}
response = requests.get(url, params=params, headers=headers)
Any ideas?