我一直在尝试使用 MailChimp API(3.0 版)的批处理端点为新用户订阅列表,但无法使其工作。这是请求:
POST /3.0/batches
{
"operations": [
{
"method" : "POST",
"path" : "lists/c852ce5c86/members",
"body": "{\"email_address\":\"email@domain.tld\", \"status\":\"subscribed\"}"
}
]
}
该请求似乎没问题,因为我收到 200 响应:
{
"id": "49abca6ef3",
"status": "finished",
"total_operations": 1,
"finished_operations": 1,
"errored_operations": 1,
"submitted_at": "2015-09-21T18:11:16+00:00",
"completed_at": "2015-09-21T18:11:23+00:00",
"response_body_url": "https://mailchimp-api-batch.s3.amazonaws.com/49abca6ef3-response.tar.gz?..."
}
但是,如您所见,我的批处理中唯一的操作是错误的。
这是response_body_url
此操作的:
[{
"status_code":400,
"operation_id":null,
"response":"{
\"type\":\"http://kb.mailchimp.com/api/error-docs/400-invalid-resource\",
\"title\":\"Invalid Resource\",
\"status\":400,
\"detail\":\"The resource submitted could not be validated. For field-specific details, see the 'errors' array.\",
\"instance\":\"\",
\"errors\":[{
\"field\":\"\",
\"message\":\"Schema describes object, NULL found instead\"
}]
}"
}]
这不是很有帮助:(
请注意,如果我直接POST lists/c852ce5c86/members
使用{"email_address":"email@domain.tld", "status":"subscribed"}
有效载荷,它可以正常工作。