I’m trying to pull agent state history for the last 24 hours using the CXone Reporting API v2. I’ve got the endpoint right, I think, but I keep hitting a 400 Bad Request.
Here’s the curl command I’m running:
curl -X POST "https://api.nice-incontact.com/api/v2/reporting/agentstates" \
-H "Authorization: Bearer <my_token>" \
-H "Content-Type: application/json" \
-d '{
"interval": "PT1H",
"metrics": ["tState"],
"groupBy": ["agentId"],
"dateFrom": "2024-05-20T00:00:00.000Z",
"dateTo": "2024-05-21T00:00:00.000Z",
"filter": "agentId IN [12345, 67890]"
}'
The response body says:
{
"message": "Invalid filter syntax",
"errors": [
"Filter expression is not valid. Expected 'AND' or 'OR' after condition."
]
}
I’ve checked the docs and the filter syntax looks correct. I’ve also tried removing the filter entirely, but then I get a 400 saying the filter is required for this metric.
I’m using dateFrom and dateTo in ISO 8601 format. I’ve also tried using from and to instead, but that doesn’t work either.
Any ideas what I’m doing wrong? I’m pulling my hair out over this one.
Thanks.