readFields
The readFields
function attempts to return fields that match all of the given filter. The specified attributes of the fields are returned for each matching field.
Results
The readFields
function may return 1 or many field objects. See the
documentation on the fieldObject
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
fieldObject[] fields = bApi.readFields(filter fieldsFilter, pageNumber);
Parameters
Name | Type | Required | Comments |
---|---|---|---|
filter |
fieldsFilter | Yes | The filter used to return only specific fields. |
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. |
pageSize |
int | No | Allows you to set a limit for the page size in order to improve performance speed. If set, the pageSize minimum is 10 and the maximum is 5,000. |
PHP Code Example
<?php /** * This example will read the details of any fields in your account that have * the name 'name' in them (example: firstname, lastname). */ $client = new SoapClient('https://api.bronto.com/v4?wsdl', array('trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)); try { $token = "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)); // filter on fields that contain 'name' $filter = array('name' => array('operator' => 'Contains', 'value' => 'name', ), ); print "reading all fields that contain the string 'name'\n"; $fields = $client->readFields(array('pageNumber' => 1, 'filter' => $filter, ) )->return; // print matching results foreach ($fields as $field) { print "Field name: " . $field->name . "; type: " . $field->type . "\n"; } } catch (Exception $e) { print "uncaught exception\n"; print_r($e); }