2015-09-21 119 views
1

我一直試圖使用MailChimp API(版本3.0)的batch endpoint將新用戶訂閱到列表,但無法使其工作。 這裏是請求:因爲我得到一個200響應MailChimp API 3.0批量請求返回400無效資源錯誤

POST /3.0/batches 

{ 
    "operations": [ 
    { 
     "method" : "POST", 
     "path" : "lists/c852ce5c86/members", 
     "body": "{\"email_address\":\"[email protected]\", \"status\":\"subscribed\"}" 
    }    
    ] 
} 

請求似乎確定:

{ 
    "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 protected]", "status":"subscribed"}有效載荷打POST lists/c852ce5c86/members,它的正常工作

+0

這是一個問題,當/批次端點首次發佈。這現在應該適合你。 – aubreyrhodes

回答

1

那實際上是mailchimp API中的一個bug,到達它們後,他們很快修復了它。

+1

好的,但mailchimp api中的錯誤在哪裏? – MidouCloud