I created a custom module in order to consume an external api call in my drupal project following this question. The module is working fine, but I need to have a pagination in the received results which will pass as a variable in the api call:


How is possible to achieve that? In case I receive all the data from the api is it possible to "separate" them somehow with pagination operation?

Thanks in advance

1 Answer 1


Is responsability of the external API paginate the results with the page parameter. If it was designed for such thing.

Then you only need to request the appropiate page.

If in another hand if you receive all the data, then, you only need to divide it.

Assuming in the referenced question that $data contains all rows, you need to divide the array (array_chunk() maybe).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.