Hit a wall with the Analytics API. Trying to pull conversation metrics for a 90-day span using the Node.js SDK. The query gets rejected with a 413 Entity Too Large.
Here’s the payload:
const query = {
interval: "2023-10-01T00:00:00.000Z/2023-12-30T00:00:00.000Z",
metrics: ["tHandle", "tAcw", "count"],
groupBy: ["userId"],
filter: {
type: "voice",
state: "completed"
}
};
The SDK serializes this into a POST body. The response is immediate 413. No helpful error message in the body. Just the status code.
I’ve tried splitting the interval into 30-day chunks. That works. But it’s messy. The SDK doesn’t have a built-in paginator for time intervals. I have to manually loop and aggregate results.
Is there a recommended way to handle large date ranges? Or is the 413 a hard limit on the query size? The docs don’t specify a max interval length. Just that the request body can’t be too big.
Also, the SDK’s analyticsApi.getQueryAnalyticsConversationDetails method doesn’t seem to support chunking. It just sends the whole query.
I’m considering writing a wrapper to split the interval. But I want to make sure I’m not missing something. Maybe a different endpoint? Or a query parameter I’m overlooking?
The server is in Africa/Lagos. Timezone isn’t the issue. The interval is absolute.
Any ideas on how to handle this without manually chunking? Or is manual chunking the only way? I’ve checked the GitHub issues. Nothing recent on this.
The 413 is consistent. Every time. With 90 days. 60 days works fine. So it’s likely the body size.
I can see the serialized JSON is around 5KB. That’s not huge. But maybe the server adds headers or other metadata that pushes it over.
I’m using version 1.2.3 of the SDK. Latest stable.
What’s the best practice here?