REST API v4: GET collection count
You can retrieve the number of subprofiles in a collection using an HTTP GET request:
https://api.copernica.com/v4/collection/$id/count
The $id must be replaced with the numerical identifier or the name of the collection for which you want to retrieve the count.
Returned fields
The method returns a JSON object with the following field:
| Variable | Description |
|---|---|
| count | The number of subprofiles in the collection. |
JSON example
The JSON response looks like this:
{
"count": 283495
}
PHP example
The following PHP script demonstrates how to call the API method:
// required scripts
require_once('CopernicaRestAPI.php');
// change this to your access token
$api = new CopernicaRestAPI("your-access-token", 4);
// execute the method and print the result
print_r($api->get("collection/{$collectionID}/count"));
This example requires the REST API class.