Hot answers tagged

26

There is no tutorial for the API, nor is there likely to be one -- at least officially. There is a "Hello World" introduction. To use the current API (version 2.2), you really only need to know/do: How to make an HTTP GET request, in the language of your choice. There are also various user-supplied libraries in .net, PHP, Python, etc. to help with this. ...


16

This page sums up request limits pretty well. Basically: Don't make more than 30 requests per second Without a key you can make 300 requests per day, with a key you can make 10,000 requests per day With an access token, the 10,000 request limit is just for your app for that user. * Without an access token, the 10,000 request limit is shared between apps ...


15

You'll need to quote that URL. wget 'http://api.stackexchange.com/2.0...&site=stackoverflow' ^ ^ (And note that the payload is gzip-compressed.)


14

It's a bit of a Catch-22. Work around it by: Make a app (or script) post for your app (or script). Also tag it with placeholder. And put "PLACEHOLDER -" at the beginning of the title. Also, indicate in the post text that the app is not yet ready for prime time. This has already been done a few times, for example: "Chatdump - a site monitor (placeholder)"...


13

It's the same as much of the web. As a rule, you don't want Content-Encoding: gzip or Content-Encoding: deflate a good 99.9999% of the time (to underestimate a bit). What you want is the actual content, exactly as it would be without the content-encoding, but to get it faster. That is to say, you want Transfer-Encoding: gzip. Transfer-Encoding: gzip also ...


12

Refer to the Stack Exchange API, Authentication docs. It looks like you are trying to authenticate using either a server you do not control, or a local server that is not on the public internet. Crucial Points: Do not specify a redirect_uri to any server that you do not control. When you use something like redirect_uri=https://www.yahoo.com/, then a third ...


11

First of all, version 1.1 of the API has been deprecated for quite some time now. Users are strongly encouraged to move their applications over to version 2.1. The URL for retrieving information about a question looks something like this: http://api.stackexchange.com/2.1/questions/ question_id ?site= site_name For example, to retrieve information about ...


11

It's pretty simple, you just append your key to the URL as a parameter. For example, looking for users 1 and 5: http://api.stackexchange.com/2.2/users/1;5?site=stackoverflow&key=YOUR_KEY_HERE So, it looks like your HTTP.call would become: HTTP.call ( "GET", urlString, {params:{site:"stackoverflow", key:"YOUR_KEY_HERE"}}, function (...


10

While this is not available I don't think SE can do much to prevent it. I don't have any easily readable code to give you code example, but the theory is following: The upload request: To upload images to Stack Exchange, you must send following POST request to https://__HOST__/upload/image: fkey: we'll talk about this token later source: web/computer ...


10

As long as has_more is set to true there is more data available. You can get this data by increasing the page parameter in your request subsequently and running new request with that changed page parameter. The next url for your example would then be https://api.stackexchange.com/docs/users#page=2&pagesize=100&order=desc&sort=reputation&...


10

The implicit flow uses the url https://stackexchange.com/oauth/dialog, not https://stackexchange.com/oauth. You should just need to change the url, otherwise that looks correct.


10

You don't need to support alias domains. They redirect to *.stackexchange.com domains, anyway. This will match all current Stack Exchange sites. It uses @match for smarter domain and path wildcards. @match also works better for Chrome: // @match *://*.askubuntu.com/* // @match *://*.mathoverflow.net/* // @match *://*.serverfault.com/* /...


9

Yes, you can change very nearly everything (and actually everything that's user entered) about an application after it's been registered. You should use the domain you intend to host the client-side app under as your OAuth Domain. While not strictly necessary, it's the sanest option.


9

template.user.js // ==UserScript== // @name Stack Exchange Userscript (Template) // @grant none // @match *://*.stackexchange.com/* // @match *://*.stackoverflow.com/* // @match *://*.superuser.com/* // @match *://*.serverfault.com/* // @match *://*.askubuntu.com/* // @match *://*.stackapps.com/* // @match *://*.mathoverflow.net/* // ==/UserScript== var ...


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 ...


8

The unofficial Winterbash inbox API If you have any user's account_id then the hats information is just one call away. And the call is http://winterbash2014.stackexchange.com/api/inbox?accountId=<account_id> For example, hats information about me can be retrieved via http://winterbash2014.stackexchange.com/api/inbox?accountId=4996787 But here are ...


7

Without a registered API key, your server's IP address will be restricted to 300 calls per day. With an API key, that limit is increased to 10000 per day. What most likely happened was that you exceeded the (free) 300 quota. After you register for an 2.0 API key, change your request URL as follows: https://api.stackexchange.com/2.0/questions?key=...


7

You need to have a data filter for the activity that you call the authentication URL in the manifest like: <data android:host="stackexchange.com" android:pathPrefix="/oauth/login_success" android:scheme="https" /> The activity also needs to override the onResume function for you to parse the URL and get the access token from the ...


7

I'll slot this in for v2.1, not super useful in general but definitely interesting information that we should make available.


7

Every response from the API can be cached for up to a minute, so making the same request multiple times in that time-frame typically won't return different results. We make note of this in the throttle documentation: While not strictly a throttle, the Stack Exchange employs heavy caching and as such no application should make semantically identical ...


7

The fix for me was unchecking "Enable Client Side OAuth Flow"


7

No. Currently the users type does not return any private_info and neither does the user_timeline type return any voting information. No other API method allows for detecting a user's vote history except one question at a time. You would have to fetch every single question and test the downvoted and the upvoted properties. If you limited your search ...


7

You cannot do this. A delete feature has been requested and requested again (with status-planned given about 3.5 years ago). Register your desire for this by immediately upvoting these posts: Deleting an application key? How to delete an OAuth (2.0) API key? (Theoretically, if those feature requests get enough upvotes, they might get some developer love.)...


7

It's allowed with the caveat there's no guarantee it won't be merged, provided that you abide by the good faith criteria. If you attempt to actually run something like the script in your previous post, for example, both accounts will likely be suspended without second thought. Having a separate account for testing doesn't shield you from the consequences of ...


7

Just use the plain /users/{ids} route. (For network-wide score, see the bottom section, below.) if you run it on your userid, it currently returns: { "items": [ { ... "reputation": 354, ... Which is what you expected. The route you used, /users/{ids}/reputation, has a different purpose. Refer to its doc page: Gets a subset of the ...


6

No, this is not available. Something like it may be available in the V3.0 timeframe, but I can't commit to that at this time.


6

AFAIK StackExchange network uses gravatars. Hence you can get their profile picture from their email address (check the gravatar site for details).


6

Python: Below is python code to get minimal info results. See bottom on how to run. import requests BASEURL = "https://api.stackexchange.com/2.2/info" params = { "site" : "stackoverflow" } r = requests.get(BASEURL, params=params) print r.json() Expected output is like: {u'has_more': False, u'items': [{u'answers_per_minute': 4.68, u'...


6

Most routes that take an ID, including the /users route, will accept multiple values separated by semicolons. For example, a query like /users/1%3B22656?site=stackoverflow will give you results for both user 1 and user 22656. You can combine up to 100 ids in this fashion.


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