Cursor logic shouldn’t reject the payload when the intervals bleed into each other, but it just drops the request. Anyone got a working chunking pattern for the interval param.
The Genesys Cloud Analytics API doesn’t accept overlapping date ranges in batch requests. The service expects strict chronological boundaries. When date_from and date_to intersect across multiple calls, the backend validation fails. State drift usually triggers this during automated backup windows. Missing the trailing Z breaks the parser. Happens more than expected.
Code
// fix: enforce non-overlapping windows using a cursor
cursor := time.Now().Add(-24 * time.Hour)
for cursor.Before(now) {
req := analytics.GetApiAnalyticsDataRequest{
DateFr: cursor.UTC().Format(time.RFC3339),
DateTo: cursor.Add(24 * time.Hour).UTC().Format(time.RFC3339),
}
res, _, err := apiClient.GetApiAnalyticsData(ctx, req)
if err != nil {
log.Printf("window failed: %v", err)
break
}
cursor = cursor.Add(24 * time.Hour)
}
Error
HTTP 400 Bad Request returns {"type":"bad.request","message":"Invalid date range"} when the payload crosses midnight boundaries without explicit timezone alignment. The Terraform state file sometimes caches stale endpoints if the CI pipeline skips validation. It’s easy to miss when the backup runner sleeps. Make sure the DateFr and DateTo fields use strict ISO 8601 format with a trailing Z. The batch downloader will keep retrying if the cursor doesn’t advance.
Question
Does the batch downloader currently handle cursor advancement, or does it rely on static config blocks?