I realized in order to update a contact's email list, I need to know all the lists the specific contact is in and put them in the ContactLists tag in the xml. Please correct me if I'm wrong though, that there is no way to update a contact's individual list subscription (i.e. add/remove this contact to a specific email list with the subscription info on other lists untouched for this contact).
Based on the above assumption, if I want to update a contact's subscription on 1 email list, I would need to be able to get all email lists that the current contact is in. So I can do an add or remove API call without messing up the subscription of other lists.
Is there a way to get a list of "email lists" for a specific contact?
If there is not a direct call, does that mean I have to grab all lists, then go through each one of them and grab all members, then compare and keep track of the lists that the contact is in?
Thanks in advance!
You are correct that when you update the contact lists a person is subscribed to, you would need to include all the lists you want them to be a member of. For example, if the contact is currently subscribed to lists 1 and 2 but you also want to add them to list 3, you would need the <ContactLists> section of that contacts XML to look something like this:
<ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/1" />
<ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/2" />
<ContactList id="http://api.constantcontact.com/ws/customers/joesflowers/lists/3" />
However, this does not mean that you would need to store which lists a person is subscribed to.
1. Perform a GET on that contact resource and obtain a contact's information, including which lists they are subscribed to.
2. Modify the returned XML to add/remove any contact lists you wish.
3. Use the PUT method against the contact resource with your modified XML as the request body to update that contact.
You can find more information on this at Adding or Removing a Contact from a List.
I hope this helps. Please let us know if you have any other questions.
Thank you for the prompt response.
I didn't realize the contact info returned by searching using email address is the short version while there is a long version that can be queried using the contact ID. Now the long version has a list of contact lists, which is what I need. But I ended up having to do 2 queries to the API though.
View API documentation, code samples, get your API key.Visit Page
We want to hear from customers like you about your favorite features and how they have helped your business or organization. Tell us by answering a few questions in...Read More