Got a 'How do I' question? Join 'Ask a Trainer' Monday to Friday, 11am to 4pm ET for instant help and pro tips!

How to delete a contact from particular list via rest api

user721369
Campaign Contributor
0 Votes

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
0 Votes

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.
Tier II API Support Engineer

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.
Resources
Developer Portal

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

Visit Page

Announcements

API Updates

Join our list to be notified of new features and updates to our V3 API.

Sign Up