使用来自Google脚本的脚本错误400 mailchimp

时间:2018-08-13 16:32:49

标签: javascript mailchimp

我正在尝试通过POST脚本发出一个Google Scripts请求,以通过mailchimpAPI中注册成员。

var payloadMail = {
    "email_address" : "teste@teste.com.br",
    "status" : "subscribed",
}
var headersMail = {
    'Authorization': 'apikey ******',
    "content-type" : "application/json",
};
var optionsMail = {
    "method" : "post",
    "data" : payloadMail,
    "headers" : headersMail,
}
var respMail = UrlFetchApp.fetch(
    "https://us18.api.mailchimp.com/3.0/lists/******/members" ,
    optionsMail);

我正在发送邮件,但是它给出了此错误:

{
    "type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
    "title":"Invalid Resource",
    "status":400,
    "detail":"The resource submitted could not be validated. For, []]...)
      [0 segundos]

当我通过postman发出相同的请求时,它就起作用了。

有什么建议吗?

0 个答案:

没有答案