The readLists function attempts to return lists that match all parameters of the given filter. The specific attributes of the lists are returned for each matching list.


The readLists function may return 1 or many list objects. See the documentation on the mailListObject for a list of the data fields that could potentially be returned.

Note: The data fields returned depend on the type of data you ask for in your request.


mailListObject[] lists = bApi.readLists(filter mailListFilter, pageNumber);


Name Type Required Comments
filter mailListFilter Yes The filter used to return specific lists.
pageNumber int Yes Retrieves the next “batch” of objects as the value specified increases from 1. In order to obtain an entire set of objects for a given call, you should increase the number value assigned to pageNumber until no more objects are returned.
pageSize int No Allows you to set a limit for the page size in order to improve performance speed. If set, the pageSize minimum is 10 and the maximum is 5,000.

PHP Code Example

 * This example will return all mailing lists in your account.  It will then
 * print each list's name; the number of active contacts on the list; and the list id.
$client = new SoapClient('', array('trace' => 1, 
                                 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
try {
  $token = "YOUR_TOKEN_HERE";
  print "logging in\n";
  $sessionId = $client->login(array('apiToken' => $token))->return;
  $session_header = new SoapHeader("",
                   array('sessionId' => $sessionId));
  $filter = array();
  print "reading all lists\n";
  $lists = $client->readLists(array('pageNumber' => 1,
                    'filter' => $filter))->return;
  // print matching list names, number of contacts on the list, and ids
  foreach ($lists as $list) {
    print "Name: " . $list->name . "; contacts: " . $list->activeCount . "; id: " . $list->id . "\n";
} catch (Exception $e) {
  print "uncaught exception\n";