我正在尝试将查询表单中添加的电子邮件条目的状态设置为取消订阅。当前,它默认订阅常规邮件列表。从我收集到的信息来看,我可以让它添加一个条目,然后使用PATCH请求,但这是一个坏习惯。
Here是我正在研究的文档。我的目的是将它们作为未订阅的成员添加到此常规邮件列表中,以便存储其详细信息。
private string InsertIntoMailChimpGeneralList(string firstName, string lastName, string email, string mailChimpListIDGeneral)
{
string returnable = "";
var apiKey = WebConfiguration.ConfigurationManager.AppSettings["MailChimpAPIKeyGeneral"];
var listId = WebConfiguration.ConfigurationManager.AppSettings["mailChimpListIDGeneral"];
var subscribeRequest = new
{
apikey = apiKey,
id = listId,
status = "subscribed", //This does nothing no matter where put
email = new
{
email = email
},
double_optin = WebConfiguration.ConfigurationManager.AppSettings["MailChimpDoubleOptInGeneral"],
};
var requestJson = JsonConvert.SerializeObject(subscribeRequest);
//Examine response and process
var responseString = CallMailChimpAPIGeneral("lists/subscribe.json", requestJson);
dynamic responseObject = JsonConvert.DeserializeObject(responseString);
return returnable;
}