Add Accounts *Agency Only*

The addAccounts function allows you to add a new account and assign all the account settings.

Overview

Your API token must belong to an Agency, Groups, or Partner Edition master account in order to create new accounts. New accounts will be added with a status of active. If you wish to update the status of an account, use updateAccounts.

Syntax

writeResult = bApi.addAccounts(accountObject[] accounts);

PHP Code Example

<?php
 
/**
 * This example will add an Agency client account and
 * print out id of the account when it is created.
 */
 
$client = new SoapClient('https://api.bronto.com/v4?wsdl', array('trace' => 1, 
                                 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
 
try {
  $token = "ADD 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));
 
  //General Settings
  $generalSettings = array(
    'agencyTemplateuploadPerm' => 1,
    'defaultTemplates' => 1,
    'enableInboxPreviews' => 0,
    'allowCustomizedBranding' => 1,
    'bounceLimit' => 7,
    'usageAlertEmail' => 'joe@example.com',
    'sendUsageAlerts' => 1,
  );
  $contactInfo = array(
    'organization' => 'ExampleCompany',
    'firstName' =>  'Joe',
    'lastName' => 'Example',
    'email' => 'joe@example.com',
    'phone' => 5555555555,
    'address' => '312 Anywhere Street',
    'address2' => 'Suite 410',
    'city' => 'Durham',
    'state'=> 'NC',
    'zip' => '27604',
    'country' => 'US',
    'notes' => 'This acccount was created via the API!',
  );
  $allocations = array(
    'startDate' => '2010-08-15T19:20:30-05:00',
    'periodFrequency' => 12,
    'emails' => 5000,
    'api' => 1,
    'bundle' => 'professional',
    'canExceedAllocation' => 1,
    'contacts' => 10000000,
    'hosting' => 100,
    'logins' => 10,
    'fields' => 100,
  );
 
  $account = array(
    'name' => 'ExampleAPIAccount4',
    'generalSettings' => $generalSettings,
    'contactInformation' => $contactInfo,
    'allocations' => $allocations,
  );
 
 
  $res = $client->addAccounts(array($account))->return;
 
  if ($res->errors) {
    print "There was a problem adding the account:\n";
    print_r($res->results);
  } else {
    print "Account has been created.  Id: " . $res->results[0]->id . "\n";
  }  
  } catch (Exception $e) {
    print "uncaught exception\n";
    print_r($e);
  }