stackexchange-apistackexchange

How to ask StackExchange for more results exceeding 30?


I'm using the Usage of /questions URI request to fetch a list of questions from stackoverflow.

https://api.stackexchange.com/2.2/questions?&order=desc&sort=activity&site=stackoverflow

This works, however it only returns 30 results. How do I specify to the API to give me other results like 10 or 100?

I'm looking for a property like 'maxResults' but found none. Help anyone?


Solution

  • Looking at the page you linked to, that “play with it” toolbox offers a parameter called pagesize, so first guess would be that that might be relevant (in combination with page.)

    https://api.stackexchange.com/docs/paging says you can not specify a pagesize larger than 100, but explains how those two parameters can be used to “paginate” through larger result sets.

    There is also a has_more property that will tell you upfront whether it makes sense to request a “next page” from your current position.