Pagination

Learn how to paginate through Guru's API results

Any API endpoint that returns an array of results is subject to be paged. The number of results that is returned per page is dependent on the API endpoint and could change over time. If the API endpoint pages the results the response will include a Link header indicating how to get the next page of results.

For instance, if using the Search endpoint with the following query using curl (authentication information has been removed from the example for brevity)...

curl https://api.getguru.com/api/v1/search/query

You may get a response with 50 results but where more results exist. In that case, there will be a Link header indicating how to get the next-page of results...

Link: < https://api.getguru.com/api/v1/search/query?token=xsfwsgsgi248rhfn2oir987kjowidjf9w87et9w8etwt >; rel="next-page"

To get the next page of results, simply make another request to the URL in the header...

curl https://api.getguru.com/api/v1/search/query?token=xsfwsgsgi248rhfn2oir987kjowidjf9w87et9w8etwt

If the response from this call again has a Link header, there are still more results. When there is no longer a Link header, you have retrieved all pages of results.