Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
107 lines (85 sloc) 3.5 KB

REST API: GET database collections

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

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

Available parameters

The following parameters can be added to the URL as variables:

Parameter Description
start The first collection to be requested.
limit Length of the requested batch.
total Whether or not the total number of collections should be counted.

More information on the meaning of these parameters can be found in the article on paging.

Returned fields

The method returns a JSON object that contains a 'data' property with all the collections for the database. Each collection contains the following fields:

Variable Description
ID The ID of the collection.
name Name of the collection.
database ID of the database this collection belongs to.
fields Array with the fields in the collection.
intentions Array with the intentions for the collection (either 1 or null for email/sms/fax/pdf).

JSON example

The JSON for a single collection might look something like this:


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", 2);

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

The example above requires the CopernicaRestApi class.

More information

You can’t perform that action at this time.