5

EDIT

To sum up the comment discussions, this has turned into a feature request for the /sites API to have an ALL parameter (like 0?) to the pagesize argument.


Original Post

Why aren't all Stack Exchange site available in the API?

Off the top of my head there is the DBA site, the Raspberry Pi site, Mathematica and many more.

Why is this?

Any release date for the other sites?

Edit: Here are the sites I have serverfault,superuser,meta,webapps,meta.webapps,gaming,meta.gaming,webmasters,meta.webmasters,cooking,meta.cooking,gamedev,meta.gamedev,photo,meta.photo,stats,meta.stats,math,meta.math,diy,meta.diy,meta.superuser,meta.serverfault,gis,meta.gis,tex,meta.tex,askubuntu,meta.askubuntu.

A bug in StacMan? I am simply using StacManClient.Sites.GetAll() that is documented as Get all the sites in the Stack Exchange network. (API Method: "/sites")

  • What are you actually trying to do? All those sites should be available through the API. – Adam Lear Sep 27 '15 at 2:10
  • @AnnaLear: I am using the StacMan library for .NET. It just requests from the API. I edited my question with the list of sites I get. – MDTech.us_MAN Sep 27 '15 at 2:31
  • I assume the paging functionality is generic so if implemented this will become possible on all API calls. I don't have high hopes this will be implemented given the possibility of hogging resources on the server when such requests fetch all data and stream back all results to the caller. – rene Sep 27 '15 at 21:10
  • @rene: I still think that this is something that should be implemented for sites, but this should Only be for sites. – MDTech.us_MAN Sep 27 '15 at 21:42
  • You should make clear in your feature request that you only want this for the /sites endpoint – rene Sep 28 '15 at 8:17
12

The API returns results in pages, defaulting to 30 items per page. Since there's far more sites on the network, you need to request subsequent pages, or use a larger page size. The maximum page size for API requests is usually 100 items, but in the case of the /sites route it's unbounded.

StacMan allows you to pass in a pagesize parameter to the GetAll() method, so if you want to avoid paging you can pass in something appropriately big. See this similar Stack Apps question for more.

  • Perhaps I should change the question to why doesn't the API allow an ALL parameter for pagesize. – MDTech.us_MAN Sep 27 '15 at 3:06
  • It would be marginally more convenient, but using a big number/iterating over the pages by checking the response for has_more works well enough that I guess it hasn't been a priority. – Tim Stone Sep 27 '15 at 3:08
  • @MDTech.us_MAN You can also visit API Usage of /sites page and run the query with options. Tim Stone is correct about pagesize. Here is a sample query I made with pagesize 300 which returns all sites. – HackerKarma Sep 27 '15 at 3:17
  • 2
    @HackerKarma: I put 9999999 for good measure. Maybe SO will grow larger than 300 sites...... :D – MDTech.us_MAN Sep 27 '15 at 3:19
  • @MDTech.us_MAN Yes, SE/SO will have that many sites in future.. I will be long gone though :D I may see 300 but not 9999999 :) – HackerKarma Sep 27 '15 at 3:22
  • 1
    @HackerKarma: Still, its a nuisance. – MDTech.us_MAN Sep 27 '15 at 3:24
1

To sum up the comment discussions, this has turned into a feature request for the /sites API to have an ALL parameter (like 0?) to the pagesize argument.

But, it already has that. From the /sites documentation:

The pagesize parameter for this method is unbounded, in acknowledgement that for many applications repeatedly fetching from /sites would complicate start-up tasks needlessly.

This means you can do something like:

http://api.stackexchange.com/docs/sites#pagesize=1000&filter=default&run=true

And return all sites (assuming that SE stays under 1000 total sites).

You must log in to answer this question.

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