0

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&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

0

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, privacy policy and cookie policy

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