logout

The logout function is used to immediately end an authenticated API session.

Overview

When successful the sessionId is no longer valid. You will need to use the login function to establish a new authenticated API session.

Syntax

result = bApi.logout();

PHP Code Example

<?php
/**
 * This script will end your API session
 *
 * @copyright  Copyright (c) 2016 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 = "A VALID API TOKEN HERE";
 
    print "logging in\n";
    $sessionId = $client->login(array('apiToken' => $token))->return;
 
    $session_header = new SoapHeader("https://api.bronto.com/v4",
                                     'sessionHeader',
                                     array('sessionId' => $sessionId));
 
    $client->__setSoapHeaders(array($session_header));
 
    // do some work....
 
    print "logging out\n";
    $client->logout();
} catch (Exception $e) {
  print "uncaught exception\n";
  print_r($e);
}