Error 400 mailchimp using script from Google Scripts

0

Hello, I'm trying to make a POST request through the Google Scripts script to register members in the mailchimp through the API.

var payloadMail = {
  "email_address" : "[email protected]",
  "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);

I'm sending so, however, it gives this error:

When I make the same request for postman, it works.

    
asked by anonymous 10.08.2018 / 23:20

0 answers