Summary
Method Name | getMetadata |
---|---|
Minimum Supported API Version | 3.0 |
getMetadata
$result = getMetadata()
The getMetadata() method returns a list of all metadata attached to 'data' fields on all tables within the companies TrackRecordPro 3 database. This API call can take some time to complete as it has to aggregate the data from many tables, therefore it is advised to cache the results of this endpoint locally.
The endpoint takes no parameters.
At the top level of the returned data, each endpoint which supports metadata/custom fields is an entry in the results, e.g. "assets" and "users". Below this, all custom fields are listed, one entry per field. Each of these is itself a key with the following possible values:
Key name | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
display_name | The name to use when displaying the field to the user | ||||||||||||||
type | Indicates that the custom field is one of the following supported data types:
| ||||||||||||||
visible | Set to true if the field is to be displayed to users, otherwise false if it is API only. | ||||||||||||||
constraints | Only set for boolean or integer field types, indicates a potential upper and lower range, for use with numeric fields | ||||||||||||||
options | Only set for options lists, contains an array of options to display in the drop down list. Facility to add extra options should be provided by any implementation. |
Parameters
$filters | The filter specifies the range of data to return. Passing an empty array or NULL indicates that all data in the endpoint should be returned. |
---|
Return value
The method returns an array documenting the metadata available within the current company, as demonstrated below:
stdClass Object ( [assets] => stdClass Object ( [$external_id] => stdClass Object ( [display_name] => External ID [type] => int [visible] => [constraints] => stdClass Object ( [min] => 0 [max] => 52654 ) ) [costcode] => stdClass Object ( [display_name] => Costcode [type] => string [visible] => 1 ) [manufacturer] => stdClass Object ( [display_name] => Manufacturer [type] => string [visible] => 1 ) [model] => stdClass Object ( [display_name] => Model [type] => string [visible] => 1 ) [ukas] => stdClass Object ( [display_name] => UKAS [type] => bool [visible] => 1 [constraints] => stdClass Object ( [min] => 0 [max] => 1 ) ) [$costcode] => stdClass Object ( [display_name] => Costcode [type] => string [visible] => ) [next_great_hat_day] => stdClass Object ( [display_name] => Next Great Hat Day [type] => datetime [visible] => 1 ) [user_assigment] => stdClass Object ( [display_name] => User Assigment [type] => options [visible] => 1 [options] => Array ( [0] => Bob ) ) ) [files] => stdClass Object ( [ancillaries] => stdClass Object ( [display_name] => Ancillaries [type] => string [visible] => 1 ) [date_received] => stdClass Object ( [display_name] => Date Received [type] => datetime [visible] => 1 ) [po_number] => stdClass Object ( [display_name] => PO Number [type] => int [visible] => 1 [constraints] => stdClass Object ( [min] => 0 [max] => 97020723785 ) ) [$external_id] => stdClass Object ( [display_name] => External ID [type] => int [visible] => [constraints] => stdClass Object ( [min] => 0 [max] => 257467 ) ) [certificate_number] => stdClass Object ( [display_name] => Certificate Number [type] => string [visible] => 1 ) ) [locations] => stdClass Object ( [$oldid] => stdClass Object ( [display_name] => Old ID [type] => int [visible] => [constraints] => stdClass Object ( [min] => 2292 [max] => 10419 ) ) [main_site] => stdClass Object ( [display_name] => Main Site [type] => bool [visible] => 1 [constraints] => stdClass Object ( [min] => 0 [max] => 1 ) ) [postcode] => stdClass Object ( [display_name] => Postcode [type] => options [visible] => 1 [options] => Array ( [0] => DE23 8YL [1] => DE24 8UP [2] => NG21 9EN ) ) [number_of_staff] => stdClass Object ( [display_name] => Number Of Staff [type] => int [visible] => 1 [constraints] => stdClass Object ( [min] => 0 [max] => 23 ) ) [bondarea_paul] => stdClass Object ( [display_name] => Bondarea Paul [type] => bool [visible] => 1 [constraints] => stdClass Object ( [min] => 0 [max] => 1 ) ) [managers] => stdClass Object ( [display_name] => Managers [type] => options [visible] => 1 [options] => Array ( [0] => Craig ) ) ) [departments] => stdClass Object ( [$oldid] => stdClass Object ( [display_name] => Old ID [type] => int [visible] => [constraints] => stdClass Object ( [min] => 0 [max] => 8431 ) ) [accounting_code] => stdClass Object ( [display_name] => Accounting Code [type] => options [visible] => 1 [options] => Array ( [0] => AC123 [1] => BC321 ) ) [manager] => stdClass Object ( [display_name] => Manager [type] => options [visible] => 1 [options] => Array ( [0] => ) ) [date_of_last_departmental_review] => stdClass Object ( [display_name] => Date Of Last Departmental Review [type] => datetime [visible] => 1 ) ) [companies] => Array ( ) [users] => stdClass Object ( [$external_id] => stdClass Object ( [display_name] => External ID [type] => int [visible] => [constraints] => stdClass Object ( [min] => 8 [max] => 15679 ) ) ) [externaltypes] => Array ( ) [assetqueue] => Array ( ) )