Is it possible to query the Analytics Conversations Aggregates API with a custom interval that does not align with the standard hourly or daily buckets? I am building a lightweight SvelteKit dashboard that requires 15-minute granularity for real-time queue monitoring. The standard polling approach feels too heavy on the client-side, so I am trying to push the aggregation logic to the server via the /api/v2/analytics/conversations/queues/aggregates endpoint.
My current implementation uses a server-side route to fetch data, but the response payload is consistently empty when I specify a custom interval string. I have verified the OAuth token permissions and the queue IDs are correct. Here is the request configuration I am sending from the SvelteKit load function:
const response = await fetch(`${baseUrl}/api/v2/analytics/conversations/queues/aggregates`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"interval": "2023-10-27T10:00:00.000Z/2023-10-27T11:00:00.000Z",
"intervalSize": "PT15M",
"groupBy": ["queueId"],
"metrics": ["offerCount", "answerCount"],
"queryFilter": {
"type": "queue",
"id": "my-queue-id-here"
}
})
});
The API returns a 200 OK status, but the entities array in the JSON response is empty: { "pageCount": 0, "pageNumber": 0, "pageSize": 0, "entities": [] }.
I have tried the following steps to troubleshoot:
- Verified the
intervalformat matches ISO 8601 duration strings. - Checked the
queryFiltersyntax against the OpenAPI spec. - Confirmed the OAuth client has
analytics:report:viewpermissions. - Tested with a larger
intervalSize(PT1H) which returns data, suggesting the issue is specific to the custom interval parsing.
Is there a limitation on intervalSize for this specific endpoint? Or is my JSON payload structure malformed for custom aggregations? I need to understand if this is a known restriction or a syntax error in my request body.