0

I am trying to create a list of leads of more then 50 items so I encounterd the limit of the list method. On the training site I already found that I need to do a call to get the next set but I have found no mention of how that should be done in php all examples are in javascript so that is of no help.

The current method calls I have tried to get it working but I only get the same set as a result:

$fistSet = CRest::call("crm.lead.list", [
  "order"=> [ "ID"=> "ASC" ],
  "filter"=> [ "UF_CRM_1600929716160"=> 632],
  "select"=> [ "ID", "TITLE", "STATUS_ID", "OPPORTUNITY", "CURRENCY_ID" ]
]);
echo "<pre>";
var_dump($fistSet);
echo "</pre>";
echo "<br>----------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>";
$total = $firstSet["total"];
$next = $firstSet["next"];
$secondSet = CRest::call("crm.lead.list", [
  "order"=> [ "ID"=> "ASC" ],
  "filter"=> [ "UF_CRM_1600929716160"=> 632], "OFFSET"=>$next,
  "select"=> [ "ID", "TITLE", "STATUS_ID", "OPPORTUNITY", "CURRENCY_ID" ]
]);
echo "<pre>";
var_dump($secondSet);
echo "</pre>";
General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • This doesn't appear to be a PHP question, so much as a question relating to a specific 3rd party API and how they handle pagination. I'd suggest checking their documentation to see how they handle pagination in subsequent requests. – Aran Sep 23 '21 at 16:26
  • I added the php tag because this is done in php. Also I checked the documentation and it says "that I need to specifiy the value in 'next' to get the next set – reventcake295 Sep 23 '21 at 19:08

1 Answers1

1

Assuming this is for Bitrix, their documentation says the response from next should be passed in a start property in your next request. So swap offset to start.

Aran
  • 2,429
  • 1
  • 19
  • 19