Hot answers tagged

8

You need to pass in a sufficiently large pagesize value, per the 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. Otherwise you'll only get 30 results, the default value for pagesize. Alternatively, you can page the ...


4

Use the /users/{ids} route to get account_id. Then pass the account_id to /users/{ids}/associated. Note that account_id is exactly the kind of information that should be heavily cached by your script/app. (Hint, hint; wink, wink; nudge, nudge. (^_^) ) For example: /2.2/users/10349?site=superuser&filter=!T6o*9deY.2ZD3-(n4f Returns: { "account_id": ...


3

Great design and great idea. I don't know whether many people still look at this, but I discovered it today and if it was advertized and used more. Some suggestions for Stackathlons: Quantitive Finance and Economics. This one has suprisingly few, while the disciplines are quite closely related. I tried to add another one, but then it gives probably zero ...


3

If you already have a token, then you can use the /me/associated network route to get the associated site for the authorized user. There's a similar route that takes a network account ID and does not require an active access token.


2

You already know the site, it has to be built in to every /questions query. But, if you are querying separate sites with concurrent AJAX queries, merely encapsulate the site name in your AJAX callback. See this Stack Overflow question for an example of doing that in javascript. Alternatively, you can parse the link property of the question response to ...


2

You can actually just pass in window.location.hostname directly: This parameter can be the full domain name (ie. "stackoverflow.com"), or a short form identified by api_site_parameter on the site object. (emphasis mine) Since the site does not provide the short form to you directly anywhere, going the full hostname route is probably your best bet. /^((?...


2

This was added in the last deploy. Originally I was planning for consumers to maintain the site cache based on host names, but I suppose it's better to have the "query with this" parameter readily available regardless of how a site is discovered.


1

Alas, this information is not in the API(Docs), nor is there an easy way to compute it from data that is available. Nor can you get visit info from SEDE or the Data Dump. Your only recourse is to scrape the sites page or to use third party providers like Quantcast or Google for traffic info. Also note that the visits/day info on the sites page is a lie, ...


1

This question is nearly a duplicate of Complete list of sites to @include / @match into my script?. This is not hard. There are only seven second-level domains to worry about and all new sites are likely to continue using a domain in the *.stackexchange.com pattern. See the above linked question for the list. But if you are especially paranoid, you can ...


1

The Sexuality site was an experiment, one which failed. We may revisit this in the future, but for now there's no point in the flag as it's one use case is gone.


1

There was some monkeying around on the backend with URI generation, it's settled down now and this issue was resolved.


1

Yes, the sites path does not filter results on site_type. But the good news is, the path accepts a pagesize of 999, so you can get all the results at once. Then you must filter the results in your app. Here's what it looks like in jQuery: $.ajax ( { type: 'GET', url: 'https://api.stackexchange.com/2.1/sites?pagesize=999&filter=!...


1

PHP /** * 101 sites sorted alphabetically * Updated 2013.04.14 */ $se_sites = array ( 'academia' => array( 'Academia', 'http://academia.stackexchange.com', 'Q&A for academics and those enrolled in higher education', ), 'android' => array( 'Android Enthusiasts', 'http://android.stackexchange.com', 'Q&A for ...


Only top voted, non community-wiki answers of a minimum length are eligible