Pagination in external api consume custom module 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:

http:/example.com/api.ashx?q=documents&amp;page=1


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
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).