6

I have the following query, which is identical to the example they give in the documentation:

http://api.stackexchange.com/2.1/questions?fromdate=1391756400&order=desc&site=stackoverflow&sort=activity&tagged=c%2B%2B

This (should) return all of the questions with that tag....but for some reason, in the JSON data, I only get the first 30. Is there a reason for this? Since I'm not explicitly specifying page size?

1 Answer 1

5

The API allows you to set a pagesize of 0 to 100 (with the exception of the /sites route, which allows larger values), and defaults to a maximum of 30 items in the response.

To get all of the items applicable to the API query, you need to check the has_more field to determine if you need to request subsequent pages via the page parameter. This is covered in more detail in the API documentation's section on paging.

3
  • I actually should have listed this in my original question, but I passed has_more=true inside the query string..and still got the same results. Maybe I need to do it via a filter instead. Commented Feb 9, 2014 at 18:11
  • 2
    has_more is returned in the response, it indicates you need to make another call with page=n to get more results. The most you'll get back with a single request is 100, assuming you set the pagesize to that. Commented Feb 9, 2014 at 21:39
  • Oooh, okay. Got it. That makes sense. I originally thought it was a wrapper variable the requestor gives. Thanks Commented Feb 10, 2014 at 14:28

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.