We’re hitting a wall with the Genesys Cloud Analytics API. Trying to pull interaction data for the last 90 days in one go, but the endpoint keeps throwing a 413 Entity Too Large error. The payload gets too big when I specify the full date range in the request body.
Here’s the JSON I’m sending to POST /api/v2/analytics/interactions/summary/query:
{
"dateFrom": "2023-10-01T00:00:00.000Z",
"dateTo": "2023-12-30T00:00:00.000Z",
"groupBy": ["interaction.type"],
"metrics": ["handledCount", "waitTime"]
}
The response is just a hard 413. I know I can split this into smaller chunks, say 7-day intervals, and loop through them in Python or a shell script. The problem is how I manage the state if I’m using the CX-as-Code Terraform provider or a custom data source. If I run a Terraform plan that tries to fetch this data as a dependency for a dashboard configuration, the plan fails immediately.
I’ve tried reducing the groupBy fields, but that doesn’t help much since the volume of interactions is high. Splitting the query manually works, but automating the recombination of results is messy. Is there a standard pattern for handling this in Terraform? Maybe a custom data source that handles the chunking internally? Or should I just pre-aggregate the data in a separate job and feed the summary stats into Terraform?
Also, does the API have a nextPage token that works with large date ranges, or is that only for pagination of results within a smaller window? The docs aren’t super clear on whether chunking the date range is the only way out. I’d prefer not to write a whole new service just to handle this aggregation. Any code snippets or examples of how others are handling large analytics queries in their IaC workflows? I’m stuck on the best way to structure this without breaking the Terraform state or getting rate limited.