Closed ampkeegan closed 3 years ago
Let me have a look....
Seems like API gets another parameter called start
, does it mean current page?
https://developers.pipedrive.com/docs/api/v1/#!/Persons/get_persons_id_activities
Yes, pagination works the same as other requests, like to get all deals. First request would be start=0, limit=500, second request would be start=500, third is start=1000, etc. Check the response for ['additional_data']['pagination']['more_items_in_collection'] = True to continue requesting.
Yeah, not sure if at this point we can implement something like pagination without any breaking changes. Since they do not have a "page" parameter, I'd say the solution would be to watch those response headers and request more manually...
Any idea how to deal with that respecting the current structure?
My php isn't strong enough to understand exactly what's happening in the source, but do the other objects->all() function not paginate? If they do it's the same process.
Looking at the response object from this call:
$acts = (array)$this->pd->persons()->activities($opts, ["limit" => 2])->getContent();
I see this in $acts['additional_data''] :
"pagination":{ "start":0, "limit":2, "more_items_in_collection":true, "next_start":2 }
The second params to listActivities() takes in the start param as well, so I could write a for loop to paginate myself,
$acts = (array)$this->pd->persons()->activities($opts, ["limit" => 2, "start" => 2])->getContent();
As of now, this is the way to go.
Since they do not have a traditional pagination system, this was not taken into account when building this package. Nobody has previously requested this functionality but will consider an implementation of an V3 if becomes an issue in future and simplify the pagination.
This by default only returns 100 activities. One can improve to 500 activities by including the ["limit"=> 500] param but it will not paginate through additional resources even if they are available via the API. Can pagination be implemented?
Thanks!