Removing all contacts from all lists

Regular Participant

Removing all contacts from all lists

I will regularly (perhaps even nightly) need to remove all contacts from all lists. To do this, my preference would be simply to post:

 

  1. an "activityType" parameter of CLEAR_CONTACTS_FROM_LISTS and
  2. a "lists" parameter of https://api.constantcontact.com/ws/customers/{username}/lists

to https://api.constantcontact.com/ws/customers/{username}/activities. That however doesn't seem to work since the "lists" parameter (number 2 in the list above) apparently requires that a specific list be referenced by ID so the lists parameter's value would look like /ws/customer/{username}/lists/2 as an example.

 

I can do a GET operation on https://api.constantcontact.com/ws/customers/{username}/lists to get all lists and parse through that to extract each list's ID to build a batch of list IDs to be cleared, but that's certainly a more cumbersome approach than I would welcome. Is there an something closer to what I describe as my preferred approach that can be used here?

1 REPLY 1
Moderator

The CLEAR_CONTACTS_FROM_LISTS activity type is used only to clear the contacts from a specific list (or set of lists if you provide multiple lists parameters).  We also provide a REMOVE_CONTACTS_FROM_LISTS activity type that will remove a contact from all lists they belong in.  I'd recommend using this activity type instead and provide a list of all the Contacts you want to clear. 

 

Can you share a little more about what you are doing with your integration? It may be that you won't need to clear contacts from all lists or that there may be a better way to use the API to accomplish your task.  Feel free to post some information here if you're willing to share publicly or email webservices@constantcontact.com if you want to take this offline. 

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page