开发者

Update email address in Mailchimp using Mailchimp API

I am trying to sync a person record from my DB to mailchimp. I can update all fields except email. Email i can update only once. On updating again it throws an error. I am using their java API. This is what i am doing -

emailType = "";
replaceInterests = false; 

mergeVars.put("EMAIL", rs.getString("email"));

Boolean rc = mcServices.listUpdateMember(apiKey, listId, mailChimpId, mergeVars, emailType, replaceInterests);

The error message on reupdating is -

com.nwire.mailchimp.MailChimpServiceException: oldEmail@email.com is not a member of listName at com.nwire.mailchimp.MailChimpServiceFactory$ClientFactory$1.invoke(MailChimpServiceFactory.java:190)开发者_运维知识库 at $Proxy0.listUpdateMember(Unknown Source) at com.nwire.mailchimp.test.TestMCList1.updateDetails(TestMCList1.java:121) at com.nwire.mailchimp.test.TestMCList1.sync(TestMCList1.java:92) at com.nwire.mailchimp.test.TestMCList1.run(TestMCList1.java:52) at com.nwire.mailchimp.test.TestMCList1.main(TestMCList1.java:35)

Please note, oldEmail@email.com in the error message is the original email address in Mailchimp shich i have successfully updated once, but still shows up on reupdations.

Thanks


I'm really not sure what you are using as mailChimpId, but this is the email as well. So, if the email changes, this variable should change as well. In your case it will look like this:

String email = rs.getString("email");
mergeVars.put("EMAIL", email);
Boolean rc = mcServices.listUpdateMember(apiKey, listId, email, mergeVars, emailType, replaceInterests);

I hope this helps (I wrote this Java wrapper and this works just fine on my server).


Along with the old email address ie

mergeVars.put("EMAIL", email);

you define the new one in the following way:

mergeVars.put("NEW-EMAIL", new-email);

So you need both the old and the new addresses in orer to update it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜