readLists

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.

Results

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.

Syntax

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

readLists Parameters

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

<?php
/**
 * 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('https://api.bronto.com/v4?wsdl', 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("http://api.bronto.com/v4",
                   'sessionHeader',
                   array('sessionId' => $sessionId));
  $client->__setSoapHeaders(array($session_header));
 
  $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";
  print_r($e);
}