Trying to pull real-time queue stats via the REST proxy in a script. Need the waiting count and agents available right now to route a call based on load. The documentation says to hit /api/v2/analytics/queues/real-time with a POST body containing the queue IDs.
Here is the JSON payload I’m sending:
{
"queueIds": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"]
}
The request comes back with a 400 Bad Request. The response body is minimal:
{
"message": "Invalid queue ID format",
"code": "invalid.request"
}
I’ve verified the ID is correct. It works fine in the developer portal when I use the GET endpoint /api/v2/analytics/queues/real-time?queueIds=a1b2c3d4.... But the POST endpoint is strict. I tried URL encoding the ID, wrapping it in quotes inside the array, and even sending a single string instead of an array. All result in 400.
Checked the network trace in the script debugger. The header Content-Type is set to application/json. The OAuth token has the analytics:report:view scope.
Is there a specific format the POST body needs? Or is this endpoint actually expecting a different structure? The docs are vague on the exact schema for the request body, just showing a generic example.
Tried using the GET method with query parameters in the GetRESTProxy action instead. That works, but it hits the rate limit faster if I have to check multiple queues. The POST method is supposed to be more efficient for batch requests.
Stuck on this for a day. Any ideas on what the POST body should look like?