REST API v4: GET database field
This method is used to request a single field in a database. It is an HTTP GET call to the following address:
https://api.copernica.com/v4/database/$databaseID/field/$fieldID
In this, $databaseID should be replaced by the numerical identifier or the name
of the database where the field is located and $fieldID with the numerical
identifier or the name of the field you want to request.
Returned fields
The method returns the following informatioon about a field
| Name | Description |
|---|---|
| ID | ID of the field in the database |
| name | The name of the field (mandatory) |
| type | Type of the field |
| value | Default value of the field |
| displayed | Boolean value to determine whether or not the field should be displayed in the user interface |
| ordered | Boolean value to determine whether or not profiles should be ordered by this field |
| length | Maximum text length for a text field |
| textlines | Number of text lines allowed for the field (used in forms) |
| hidden | Boolean value to determine whether or not the field should be hidden in the user interface |
| index | Boolean value to determine whether or not the field should be indexed |
PHP example
The following PHP script demonstrates how to use the API method:
// dependencies
require_once('CopernicaRestAPI.php');
// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 4);
// do the call, and print result
print_r($api->get("database/{$databaseID}/field/{$fieldID}"));
The example above requires the CopernicaRestApi class.