clearLists
The clearLists
function is deprecated.
Overview
The clearLists function allows you to remove all contacts from a list, hence leaving it completely empty. This does not delete the contacts from your account. The clearLists call:
- Does not generate events for contacts removed from the affected lists.
- Will not trigger workflows when contacts are removed from the affected lists.
- Might result in incorrect membership for segments that reference the affected lists.
If you need any of the above behaviors, you should not use the clearLists
function. You should call readContacts using the list as a filter to get a list of contact
IDs and then call removeFromList to remove these contacts from the
list.
Syntax
writeResult = bApi.clearLists(mailListObject[] lists);
Attributes
Name | Type | Required | Description |
---|---|---|---|
id |
string | Yes (unless the list name is used) | The unique id assigned to the list. You can obtain the id for a list by calling readLists, or by looking at the footer when viewing the overview page for an individual list in the application. |
name |
string | Yes (unless name the list id is used) | The internal name of the list. |
PHP Code Example
<?php /* This example will clear two lists of all contacts on those lists. You must edit the code to refer to the list id you wish to clear. */ $client = new SoapClient('https://api.bronto.com/v4?wsdl', array( 'trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS )); setlocale(LC_ALL, 'en_US'); try { $token = "YOUR API TOKEN"; print "logging in "; $sessionId = $client->login(array( 'apiToken' => $token ))->return; $session_header = new SoapHeader("http://api.bronto.com/v4", 'sessionHeader', array( 'sessionId' => $sessionId )); $client->__setSoapHeaders(array( $session_header )); $ids = array( array( 'id' => 'YOUR FIRST LIST ID' ) , array( 'id' => 'YOUR SECOND LIST ID' ) ); $res = $client->clearLists($ids)->return; if ($res->errors) { print "There was a problem clearing your lists: "; print $res->results[$res->errors[0]]->errorString . " "; } else { print "Lists have been cleared "; } } catch(Exception $e) { print "uncaught exception\n"; print_r($e); } ?>