building a custom reporting dashboard that pulls conversation metrics directly from the Genesys Cloud Analytics API. The goal is to retrieve aggregated data for a specific, non-standard time window using the POST /api/v2/analytics/conversations/aggregates/query endpoint. The standard date presets like last24hours or last7days do not fit our billing cycle requirements, so we need to define a custom interval.
According to the documentation, the interval parameter should follow the ISO 8601 duration format. I have constructed the JSON request body as follows:
{
"interval": {
"from": "2023-10-01T00:00:00Z",
"to": "2023-10-01T23:59:59Z"
},
"groupBy": ["queue.id"]
}
When I execute this request via our Terraform-managed backend service, the API returns a 400 Bad Request response. The error payload indicates:
{
"code": "invalidRequest",
"message": "Interval format is invalid. Expected ISO 8601 duration."
}
I have verified the ISO 8601 syntax multiple times. The from and to timestamps seem correct for the desired window. I have also tried adjusting the interval object structure, but the same error persists. It appears the API is rejecting the interval parameter when combined with explicit date fields, or perhaps the format expected is slightly different for this specific endpoint.
Has anyone successfully queried this endpoint with a custom interval? Is there a specific nuance in the date formatting or the interval object structure that I am missing? I suspect the issue might be related to how the SDK handles the JSON body encoding, but I am making raw HTTP calls to rule out SDK quirks. The response is consistently a 400 error, which suggests the payload structure is fundamentally incorrect. I need to get this working before our next sprint review.