readApiTokens
The readApiTokens
function attempts to return the requested data for accounts that match the given accountFilter.
Results
The readApiTokens function may return 1 or many API token objects. See the documentation on the apiTokenObject for a list of the data fields that could potentially be returned.
Note: The data fields returned depend on the type of data you ask for in your request.
Syntax
apiTokenObject[] apiTokens = bApi.readApiTokens( filter apiTokenFilter,
pageNumber );
Parameters
Name | Type | Required | Description |
---|---|---|---|
filter |
apiTokenFilter | Yes | The apiTokenFilter allows you to read data from a specific apiToken(s). |
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 read the details of an API token */ $client = new SoapClient('https://api.bronto.com/v4?wsdl', array('trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS) ); try { // Add your API token $token = "API 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)); // Add in a valid account ID $filter = array( "accountId" => "ADD ACCOUNT ID",); $api_tokens = $client->readApiTokens(array( "filter" => $filter, "pageNumber" => 1 ) )->return; // Print matching token names, ids, and permissions foreach ($api_tokens as $api_token) { print "Name: " . $api_token->name . "; ID: " . $api_token->id . "; Permissions: " . $api_token->permissions . "\n"; } } catch (Exception $e) { print "uncaught exception\n"; print_r($e); }