Quick question about constructing the query payload for the Analytics Conversations Aggregates API endpoint (GET /api/v2/analytics/conversations/voice/query). I am building a Ruby on Rails middleware service to ingest high-volume voice interaction data and aggregate it into custom time intervals for our internal dashboard. The goal is to pull metrics like handle_time and wrap_up_time in 15-minute buckets rather than the default hourly or daily aggregates.
I am using Faraday to handle the HTTP requests, and while simple queries with standard date ranges work perfectly, adding a custom interval filter seems to trigger a 400 Bad Request response from the Genesys Cloud API. The error message is generic, stating “Invalid query parameters,” which makes debugging quite difficult without more specific validation feedback.
Here is the YAML representation of the JSON payload I am constructing in my Rails model before sending the POST request to the analytics endpoint:
query:
interval: "PT15M"
view:
id: "voice"
type: "voice"
dateFrom: "2023-10-01T00:00:00Z"
dateTo: "2023-10-01T23:59:59Z"
entities:
- id: "my-queue-id"
type: "queue"
groupBy:
- id: "interval"
metrics:
- id: "handle_time"
- id: "wrap_up_time"
- id: "abandoned"
I have verified that the dateFrom and dateTo strings are valid ISO 8601 formats and that the queue ID exists. The interval string PT15M follows the ISO 8601 duration format, which I assumed would be compatible with the API’s expectation for custom intervals. However, the API consistently rejects this payload.
Is there a specific constraint on the interval field when using the groupBy: interval option? I noticed in some documentation snippets that certain views might restrict the granularity of the interval. Could the issue be related to the view configuration or perhaps the way I am structuring the entities array? I am processing these requests asynchronously via Sidekiq, so I am confident the issue lies strictly with the payload construction rather than timeout or concurrency limits.
Any insights into the correct structure for custom interval queries in the Analytics API would be greatly appreciated. I am eager to understand if I am missing a subtle requirement in the API specification regarding aggregate views.