MailChimp retrieve large list data

Viewed 82

I have a campaign that I want to analyze, and for this I use the MailChimp open-details API call:

curl -X GET 'https://<server>.api.mailchimp.com/3.0/reports/<CAMPAIGN ID>/open-details?offset=50&count=1000' --user "anystring:APIKEY"

However, the campaign has 36 thousand members, and the limit seems to be one thousand. I have set the offset to 50, but I cannot see any link for the next page in the pagination. Is it possible to retrieve such a large number from MailChimp?

1 Answers

Offset is the number of records to skip, not the number of pages. To get the 2nd page, you need to set offset to 1000.

curl -X GET 'https://<server>.api.mailchimp.com/3.0/reports/<CAMPAIGN ID>/open-details?offset=1000&count=1000' --user "anystring:APIKEY"

To get the 3rd page, you need to set offset to 2000.

curl -X GET 'https://<server>.api.mailchimp.com/3.0/reports/<CAMPAIGN ID>/open-details?offset=2000&count=1000' --user "anystring:APIKEY"

And so on.

Check the number of records in the result to determine when to stop iterating. If the number of records is less than 1000, then you reached the last page.

Related