AddContactTolist, RemoveContactFromList

MarcusM951
Regular Participant

AddContactTolist, RemoveContactFromList

In a nutshell what i need is something like this

 

AddContactToList (list id, contact id)

RemoveContactFromList (list id, contact id)

 

Seems to me that to remove a contact from a specific list is very cumbersome and requires multiple API calls. Also if you are not extremely careful then you may remove somene from a list that you didn't intend.

 

Correct me if I am wrong, but to remove someone from a specific list you have to

 

1) retrieve the contact by email address

2) remove that specific list from the list array, which involves a loop through the list and building a new updated list

3) update that contact passing the new list

3 REPLIES 3
Elijah_G
Member

Hello,

 

You are correct about this being the "correct" method to remove a contact from a list. There was a separate method that was not officially documented which could provide a shorter set of steps. However, I need to verify that this method is valid and supported, because I would not want to share and endpoint that might not work in the future. Hopefully I should have an update on that front early next week!

 

Sincerely,

Elijah G.
API Support Engineer
MarcusM951
Regular Participant

I certainly appreciate the reply. Let me know what you find out. Thanks!

Hello,

 

It took me a bit longer to get some answers on this, but I verified that we do have an endpoint on the API that is currently undocumented, but I was able to confirm that it does work. You can remove a contact from a specific list with the following API call: 

DELETE: https://api.constantcontact.com/v2/contacts/CONTACTID/lists/LISTID

On success, this will return a 204 status code with no contents.

 

Hopefully this helps you out! If you have any questions, please let me know!

 

Sincerely,

Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page