Pagination with API data

I want to show a bootstrap table based on API data.

  1. API Action: GET from https://app.mrpeasy.com/rest/v1/manufacturing-orders
  2. Show table

This all works fine, except that the API only shows the first 100 results. I want pagination to show the other results too. The results are provided in the header data from MRPEasy, like so:

Content-Range →items 0-99/1476

I assume something should be done with the paging generator and query manager, but I’m not sure how to start. Any docs or pointers?

From the MRPeasy docs:

The maximum length of list is 100 objects at a time. If there are more than 100 objects in the database, response code will be 206 and response will include HTTP header Content-Range with indexes of the first and the last objects and total number of objects. Please note that the index of the last object is equal to the total number of objects minus 1.

In order to receive next objects from the list, your request should include HTTP header Range with index of the first object that should be returned.
To receive less than 100 objects, include HTTP header Range with indexes of the first and the last objects.

For example:

Content-Range: items 0-99/250 - response contains first 100 objects of 250.

Content-Range: items 200-249/250 - response contains last 50 objects of 250.

Range: 200 - request 100 objects starting from 201.
Range: 10-14 - request 5 objects starting from 11.

Community Page
Last updated: