Skip to content Skip to sidebar Skip to footer

Paginate Results, Offset And Limit

If I am developing a web service for retrieving some album names of certain artist using an API, and I am asked: The service should give the possibility to paginate results. It sh

Solution 1:

Paginating means you do not get all results, but pages with up to limit results.

limit  == how many results to return per call  
offset ==  which "page" you are on 

if limit == 50 and offset == 150 you return results 151 to 200 (page 4)

You should use a default limit of 50 results and return 150 results per page at maximum even if a limit of 1000 is requested.


Post a Comment for "Paginate Results, Offset And Limit"