Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time

REST API: GET database fields

This method is used to request all fields in a database. It is an HTTP GET call to the following address:$id/fields?access_token=xxxx

In this, $id should be replaced by the numerical identifier or the name of the database you want to request the fields of.

Available parameters

This method only support paging parameters. More information on these parameters can be found in the article on paging.

Returned fields

The method returns a list of fields in the database. For each field, the following properties are displayed:

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

// change this into your access token
$api = new CopernicaRestAPI("your-access-token", 3);

// parameters to pass to the call
$parameters = array(
    'limit'     =>  100
// do the call, and print result
print_r($api->get("database/{$databaseID}/fields", $parameters));

The example above requires the CopernicaRestApi class.

More information