We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

How to delete a contact from particular list via rest api

user721369
Participant

How to delete a contact from particular list via rest api

i want to delete single contact from particular list not to delete that contact from all the list

POST   https://api.cc.email/v3/activities/contact_delete

Body

{
"contact_ids": [
"contactid"
],
"list_ids": [
"listid"
]
}

Response error

[ { "error_key": "contacts.api.bad_request", "error_message": "contact_ids, list_ids are mutually exclusive" } ]

 

 

 

1 REPLY 1
Courtney_E
Moderator

Thank you for reaching out to Constant Contact API Developer Support. My team is here to assist outside software developers with questions about building into Constant Contact's API.

 

The Post /activities/contact_delete endpoint in your example is used to to bulk delete contacts from an account. Deleting a contact this way will strip all list memberships and remove the contact from the UI.

 

Here are two ways to remove specific contact(s) from specific list(s):

 

Option 1.)

Use the /activities/remove_list_memberships endpoint to remove an array of specific contact_ids from specific list_ids

 

Remove Contacts from Lists Bulk Activity
https://v3.developer.constantcontact.com/api_guide/remove_list_membership.html

 

Option 2.)
Step A: 

First, run GET /contacts to retrieve the existing contact info for the contact(s) you would like to update

 

GET Contact Data
https://v3.developer.constantcontact.com/api_guide/contacts_overview.html#search-for-contacts

 

Step B:

Then, edit the contacts’ data (in this case, remove the list_ids that you don’t want them on) and send the data back with PUT /contacts/{contact_id} to update the existing contact with the new submission information. When you update a contact using a PUT, all properties are updated, overwriting all existing property values. Any properties left blank or not included in the PUT will be overwritten with a null value.

 

PUT (update) a Contact

https://v3.developer.constantcontact.com/api_reference/index.html#!/Contacts/putContact

 

Please have a look and let us know if you have any other questions!

 


Regards,

Courtney E.
API Support Specialist

Did I answer your question?
If so, please mark my post as an "Accepted Solution" by clicking the Accept as Solution button in the bottom right hand corner of this post.
Developer Portal

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

Visit Page