addHeaderFooters

The addHeaderFooters function allows you to add new reusable headers and footers that can be included at the top and bottom of messages.

Syntax

writeResult = bApi.addHeaderFooters(headerFooterObject[] headerFooters)

Attributes

Name Type Required Description
name string Yes The name assigned to the header/footer.
html string Yes The HTML version of the header.
text string Yes The text version of the header
isHeader boolean Yes Set to TRUE if the object is a header.

PHP Code Example

<?php
/**
 * This script will add a header
 *
 * @copyright  Copyright (c) 2011 Bronto Software (http://www.bronto.com)
 */
 
$client = new SoapClient('https://api.bronto.com/v4?wsdl', array('trace' => 1, 
                                 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
 
try {
 
  // Add your API token
  $token = "ADD 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));
 
  // Add a header with some HTML and plain text content
  // isHeader should be set to false if you want to create
  // a footer.
  // Be sure to replace all place holder content with real
  // data.
 
  $headerFooterObject = array('name' => 'EXAMPLE HEADER NAME',
                 'html' => '<div>Header 
                       <span style="font-family: \'comic sans ms\', sans-serif; font-size: 14pt;" xml="lang">example</span> 
                       <strong>text</strong>
                       </div>',
                 'text' => 'PLAIN TEXT CONTENT',
                 'isHeader' => true
            );
 
  print "Adding the header\n";
  $write_result = $client->addHeaderFooters(array($headerFooterObject)
                    )->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 header:\n";
    print_r($write_result->results);
  } else {
    print "The header has been added.  Id: " . $write_result->results[0]->id . "\n";
  }
 
} catch (Exception $e) {
  print "uncaught exception\n";
  print_r($e);
}
?>