Search code examples
phpapiactivecollab

Unable to retrieve all record via API due to limit of 100


I have setup PHP API for ActiveCollab with following setup.

PHP 7.4 ActiveCollab version 7.1.141

I have downloaded https://github.com/activecollab/activecollab-feather-sdk and based on that created my code to fetch projects.

Issue is, it fetch only 100 records. My system has 250+ projects.

<?php
$authenticator = new \ActiveCollab\SDK\Authenticator\SelfHosted('Company Inc', 'My App', '[email protected]', '**********', 'https://ac.url/');
$authenticator->setSslVerifyPeer(false);
$token = $authenticator->issueToken();

$client = new \ActiveCollab\SDK\Client($token);

$newarray=array();
$responsedata=$client->get('projects')->getJson();

How can i fetch all record in 1 API call?


Solution

  • It's not possible to get all projects with a single API call. You'll have to loop through pages. Here's my older answer to a similar question that covers just that:

    https://stackoverflow.com/a/65319385/338473