readDeliveryRecipients

The readDeliveryRecipients unction returns a deliveryRecipientStatObject for each list or segment a delivery was sent to. A deliveryRecipientStatObject is also returned for single contact deliveries.

Results

The readDeliveryRecipients function may return 1 or many deliveryRecipientStatObject objects. For example, if a delivery was sent to 4 lists, a deliveryRecipientStatObject will be returned for each list sent to in the delivery (provided you don’t filter the request by listId). See the documentation on the deliveryRecipientStatObject for a list of the data fields that could potentially be returned.

Note: This function does not return a list of each contact who received the delivery. It does return an id for the list or segment the delivery was sent to. If the delivery was only sent to a single contact, a contact id is returned. For more information on result limits and paging, see How To Read Objects.
Note: The data fields returned depend on the type of data you ask for in your request.

Syntax

deliveryRecipientStatObject[] deliveries = bApi.readDeliveryRecipients( 
	      filter deliveryRecipientFilter, pageNumber);

Parameters

Name Type Required Description
filter deliveryRecipientFilter Yes Filter based on a specific delivery and the list, segment, or contact it was sent to.
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.

PHP Code Example

<?php
/**
 * This example will return the delivery data for a delivery
 * that was sent to a specific list.
 */
 
 $client = new SoapClient('https://api.bronto.com/v4?wsdl', 
                array('trace' => 1, 
                 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)
             );
 
setlocale(LC_ALL, 'en_US');
 
try {
  // Add in a valid API token
  $token = "VALID API TOKEN";
 
  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));
 
  // Set up a filter to return metrics for a delivery sent to a specific list. 
  // Be sure to replace the generic text below with a valid delivery and
  // list id.
  $filter = array('type' => 'OR',
          'deliveryId' => 'DELIVERYID',
          'listId' => 'LISTID'
                       );
 
  print "Reading delivery data for a delivery sent to a specific list\n";
  $deliveries = $client->readDeliveryRecipients(array('pageNumber' => 1,
                        'filter' => $filter,
                        )
                      )->return;
 
  // Print matching results
  foreach ($deliveries as $delivery) {
    print_r($deliveries);
}
 
} catch (Exception $e) {
  print "uncaught exception\n";
  print_r($e);
}