MailChimp API 3.0 批处理请求 returns 400 无效资源错误
MailChimp API 3.0 batch request returns 400 Invalid Resource error
我一直在尝试使用 MailChimp API(3.0 版)的 batch endpoint 为新用户订阅列表,但无法正常工作。
这是请求:
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\"
}]
}"
}]
这不是很有帮助:(
请注意,如果我直接使用 {"email_address":"email@domain.tld", "status":"subscribed"}
有效载荷攻击 POST lists/c852ce5c86/members
,它会正常工作。
这实际上是 mailchimp API 中的一个错误。联系到他们后,他们很快就修好了。
我一直在尝试使用 MailChimp API(3.0 版)的 batch endpoint 为新用户订阅列表,但无法正常工作。 这是请求:
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\"
}]
}"
}]
这不是很有帮助:(
请注意,如果我直接使用 {"email_address":"email@domain.tld", "status":"subscribed"}
有效载荷攻击 POST lists/c852ce5c86/members
,它会正常工作。
这实际上是 mailchimp API 中的一个错误。联系到他们后,他们很快就修好了。