MailChimp检索大列表数据



我有一个想要分析的广告系列,为此我使用MailChimp open-details API调用:

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

然而,该活动有36000名成员,上限似乎是1000。我已将偏移量设置为50,但在分页中看不到任何下一页的链接。有可能从MailChimp中检索到这么大的数字吗?

Offset是要跳过的记录数,而不是页面数。要获得第二页,您需要将偏移量设置为1000。

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

要获得第三页,您需要将偏移量设置为2000。

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

等等

检查结果中的记录数,以确定何时停止迭代。如果记录数少于1000,则您到达了最后一页。