MailChimp API 3.0批处理请求返回400无效资源错误

时间:2015-09-21 20:59:13

标签: mailchimp mailchimp-api-v3.0

我一直在尝试使用batch endpoint的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"},它就能正常运行。

1 个答案:

答案 0 :(得分:1)

这实际上是mailchimp API中的一个错误。到达他们后,他们很快就修好了。