PATCH/POST404=? (Mailchimp API 3.0 + Google Apps 脚本 UrlFetchApp)

PATCH/POST 404 =? (Mailchimp API 3.0 + Google Apps Script UrlFetchApp)

我不是程序员...所以,这里出了什么问题?为什么会出现这个 404 错误?

如何通过 API 3.0 + Google Apps 脚本在 Mailchimp 中更新新成员?

  // URL and params for the Mailchimp API
  var root = 'https://'+ mc_api_key.split('-')[1] +'.api.mailchimp.com/schema/3.0';
  var api = '/lists/' + mc_list_id + '/members/' + mc_user_id + '';//
  var params = {"headers": {"authorization": 'apikey '+ mc_api_key}};

  var payload = {
  "email_address": email,
  "merge_fields": { // this are Google Forms onsubmit() fields 
    "EMAIL": email,
    "FNAME": nome,
    "LNAME": sobrenome,
    "PERSONA": persona
     },
  };


  var options = {"headers":{ "Authorization":"apilkey " + mc_api_key},
                 "method":"PATCH",
                 "Content-Type":"application/json",
                 "muteHttpExceptions" : true,
                 "payload": JSON.stringify(payload) }; 


  var response = UrlFetchApp.fetch(root+api,options);
  var rc = response.getResponseCode();
 Logger.log(rc);

}

有一堆 HTML 只是为了解释这是一个 404 错误。

当其他一切都失败时,read the doc :)

它说 URL 是:

https://<dc>.api.mailchimp.com/3.0/lists/{list_id}/...

您正在使用这个:

https://<dc>.api.mailchimp.com/schema/3.0/lists/{list_id}/...

这可以解释 404。

api.mailchimp.com/schema/3.0/ 下的所有内容都是 description of the API,而不是 API 本身)