REST Proxy v4.5.1 mangling query params for /api/v2/analytics/queues/realtime

GET /api/v2/analytics/queues/realtime returns a 400 Bad Request with {“code”:“bad_request”,“message”:“Invalid query parameter: interval”}. Step one: the Studio flow needs to pull live agent counts before routing to the overflow queue, so we’ve wired up a REST Proxy endpoint to hit that v2 Reporting call. The SNIPPET action builds the query string with interval=pt1h&group=queue&from=now-1h&to=now. The payload looks fine on paper, but the API keeps rejecting the interval parameter even though the docs say it’s optional for realtime stats. Stripping it out flips the error to missing required parameter: group. Swapping group to agent just cycles through different 400s. The auth token is fresh, pulled from the standard OAuth2 flow, and the same headers work perfectly against the historical endpoints.

Step two: I checked the request routing. Postman handles the exact same call without breaking a sweat, which points to something in the REST Proxy v4.5.1 query string encoder or maybe how Studio escapes the + in pt1h. We’re running this out of London, so the local clock is pushing BST, but the API expects strict UTC. Dropping the Z and swapping it for +00:00 makes the request hang until it times out at thirty seconds. The response headers show x-cxone-request-id matching across every retry, so it’s definitely hitting the same routing rule. I’ve tried base64 encoding the entire query string before passing it to the proxy, which just returns a 415 Unsupported Media Type. The SNIPPET variable holding the URL gets truncated if I add extra query params, but I’m well under the character limit.

The REST Proxy in Studio is notoriously picky about URL encoding, especially with ISO 8601 durations like pt1h. It’s likely stripping the ampersands or misinterpreting the interval format before it even hits the Genesys Cloud gateway.

Instead of building the query string manually in the SNIPPET action, try passing those values as separate body parameters if the endpoint allows it, or use the Encode function on each parameter individually. But honestly, for real-time queue data, the Reporting API might be overkill and too slow for a routing decision anyway.

Check if you can use the GET /api/v2/queues endpoint with the expand parameter set to statistics. It’s cleaner and often faster for simple agent counts.

{
 "method": "GET",
 "url": "https://api.mypurecloud.com/api/v2/queues?expand=statistics",
 "headers": {
 "Authorization": "Bearer {{token}}"
 }
}

If you stick with the analytics endpoint, double-check that your interval is strictly PT1H (uppercase) and that the from/to params are RFC3339 compliant. Studio sometimes mangles lowercase time strings.