6

Can we increase this limit to something more reasonable (other than 100).

The cap of 100 for posts seems reasonable, however I cannot return the entire site list in one request. Due to the rapid growth of the network I now have to use two requests to grab the entire site list.

Furthermore, the documentation page shows this enter image description here which myself and a few other users found as misleading. To me this indicates the limit is at 999 and not 100 (I do realize that indicates numeric input).

Is there a good reason behind this limit, like to reduce individual request times? Can this limit be increased to at least encompass the entire site list?

note:

it has been pointed out to me that 1.0 api does not have a pagesize limitation and therefore will return all sites. This to me is another point in favour of this functionality.

2 Answers 2

6

For /sites (and only it) I have removed the pagesize constraint.

I believe in this case it makes sense, since applications are expected to query all of that data and cache it for long periods of time. The constraint remains elsewhere, as it's very important for performance reasons.

6
  • +1 - Agreed, it makes sense in other places, but I am glad it has been removed from the /sites (quickly updates all of his code)
    – rlemon
    Commented Jan 20, 2012 at 21:43
  • So if I understand this correctly, all sites are returned if no pagesize parameter is supplied? Or does one need to be supplied? Commented Jan 20, 2012 at 21:59
  • @GeorgeEdison - no, you still need to supply a pagesize. Commented Jan 20, 2012 at 22:55
  • @KevinMontrose, thank you! I can finally move some old code from 1.0 without major changes, though returning all sites if no pagesize is specified would be nice.
    – Jonathan.
    Commented Jan 21, 2012 at 0:22
  • @Jonathan: Stay tuned - I have an announcement to make in a few minutes that might help. Commented Jan 21, 2012 at 1:17
  • @Jonathan: Okay, please see my answer below - it solves the problem of the API not returning all sites when no pagesize is specified. Commented Jan 21, 2012 at 1:48
1

I admit that this answer is a little late in light of the fact that the API now allows an unlimited pagesize to be specified to retreive all sites. However, I had planned to create this simple little demo ahead of time anyway and it still does offer one nice extra feature, so here goes:

My PHP library (Stack.PHP) contains a number of examples demonstrating simple usage and more complex queries. One of these examples is a small script that fetches all Stack Exchange sites (across all pages) and returns the results as JSON/JSONP. As is recommended by the API documentation, this data is cached for 24 hours and is only retrieved when requested.

Here is the URL: http://stackphp.quickmediasolutions.com/examples/src/simple_api.php

Note that both JSONP support and CORS headers are provided on that page - so accessing it should be virtually identical to accessing the API.

You can view the source (which is quite minimal) here:
http://stackphp.quickmediasolutions.com/examples/view_source.php?file=simple_api.php

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .