简体   繁体   English

通过REST API / GET请求订阅Mailchimp列表

[英]Subscribe to Mailchimp list by REST API / GET request

How to easily, with a single HTTP request, add an email to a MailChimp subscribers list? 如何通过单个HTTP请求轻松地向MailChimp订阅者列表添加电子邮件? Just from a command line with curl or from within a browser with, for example, new Image().src = '…' . 只需从带有curl的命令行或在浏览器中使用,例如, new Image().src = '…'

In short: 简而言之:

curl 'http://{LOGIN}.{DATACENTER}.list-manage.com/subscribe/post?u={USER_ID}&id={LIST_ID}&EMAIL={SUBSCRIBER}'

Add more MERGE fields by appending get parameters like this: 通过附加get参数添加更多MERGE字段,如下所示:

curl 'http://{LOGIN}.{DATACENTER}.list-manage.com/subscribe/post?u={USER_ID}&id={LIST_ID}&EMAIL={SUBSCRIBER}&MERGE1=value&MERGE2=value2'

What about LOGIN, DATACENTER, u, id? 那么LOGIN,DATACENTER,你,id?

  • LOGIN is the MailChimp account name; LOGIN是MailChimp帐户名称;
  • DATACENTER is just a DC the endpoint is located in; DATACENTER只是端点所在的DC;
  • u is the user ID; 是用户名;
  • id is the subscribers list ID. id是订户列表ID。

Mailchimp docs advice to get these values by ripping them out of an embedded form HTML code. Mailchimp docs建议通过从嵌入式表单HTML代码中删除它们来获取这些值。

For me, the form code looks like this gist , and the corresponding URI looks like this: 对我来说,表单代码看起来像这个gist ,相应的URI如下所示:

http://inshaker.us10.list-manage.com/subscribe/post?u=3750251e6abbbabf6c38f93bf&id=dded750b1a&EMAIL=a@b.c

NOTE : This is not an API call. 注意 :这不是 API调用。 Mailchimp API is based on JSON-RPC and is a bit harder to use from the command line or client-side JS. Mailchimp API基于JSON-RPC,从命令行或客户端JS使用起来有点困难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM