addLists

The addLists function allows you to add one or more new lists to the account.

Syntax

writeResult = bApi.addLists(mailListObject[] lists);

Attributes

Name Type Required Description
name string Yes The internal name of the list.
label string Yes The external (customer facing) name of the list.
id string No 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.
activeCount long No The number of active contacts of currently on the list.
status string No The status of the list. Valid values are active, deleted, and tmp

PHP Code Example

<?php
/**
 * This script will add a new list to Bronto.
 *
 * @copyright  Copyright (c) 2018 Bronto Software (http://www.bronto.com)
 */
$client = new SoapClient('https://api.bronto.com/v4?wsdl', array(
	'trace' => 1,
	'features' => SOAP_SINGLE_ELEMENT_ARRAYS
));
try {

	$token = "ADD YOUR 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
	));

	$mailListObject = array(
		'name' => 'some_list',
		"label" => 'EXAMPLE LIST'
	);
	print "Adding the list\n";
	$write_result = $client->addLists(array(
		$mailListObject
	))->return;

	// Note we are accessing the results and errors arrays.
	// Both of these arrays are returned as part of
	// writeResult object.
	if ($write_result->errors) {
		print "There was a problem adding the list:\n";
		print_r($write_result->results);
	}
	else {
		print "The list has been added.  Id: " . $write_result->results[0]->id . "\n";
	}
}

catch(Exception $e) {
	print "uncaught exception\n";
	print_r($e);
}

?>