我试图使用nodejs调用mailchimp API V3,并表示要在列表中添加联系人,但是我总是遇到此错误
play = random.sample([0, 2], 2)
这里是使用的代码,不知道我在哪里做错了
"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the \'errors\' array.","instance":"f8b79d9b-1c02-4062-a0e4-847e31f7bd61","errors":[{"field":"","message":"Schema describes object, NULL found instead"}]}'
我尝试将/ Listkey / members添加到我的网址中,但没有成功
您有一些建议吗?谢谢
答案 0 :(得分:0)
我找到了解决方案,传递给请求的元素不好。 这是功能代码:
app.post("/", function(req,res){
var email = req.body.email;
var data ={
"email_address": email,
"status" : "subscribed"
};
var options = {
"url": "https://us20.api.mailchimp.com/3.0/lists/c9b9a6e109/members/",
"method": "POST",
"headers": {
"Authorization": "thomas APIKEY"
},
"body": data,
"json": true
};