pagination in publishing APIS which are to be consumed in another project.

0
Hi Team, I need to implement pagination while publishing API in mendix. My output is in json format.   
asked
1 answers
1

Use the custom option in the retrieve from database from which you can control which set of records to retrieve. You'll need to implement the logic for the pages yourself. Maybe return 1000 records as a page, then allow the calling side to set the page number in the request. So if they call your api with page 3 you can calculate that the offset needs to be 2 *1000= 2000 and the retrieve needs to have the amount set to 1000.

Often in this situation it is common to provide information on whether more records are available. You can do this with the help of a count and then divide by the amount to get the max number of pages and compare this to the page that is requested or always provide the max pagenumber with the response.

Hope this helps in defining the paging for your api.

answered