Hot answers tagged

27

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


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


15

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


14

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

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


12

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


11

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


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

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

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

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


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


8

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

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

This is what custom filters are for. For example, if you append &filter=!BGRhem4Z)WIti9lP55R*tgr(Jq_fHC to your query, above, you will get results without upvote_count, downvote_count, or owner information. (The first two aren't included by default anyway.) An easy way to create a filter is to use the filter-edit tool, on the appropriate doc page for ...


7

You can see your apps, that you registered with the registration page, by going to: stackapps.com/apps/oauth This page is different for every user and you will be forced to log-in to see it. The only place I have ever found this link is in a sidebar on Stack App's home page:


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


7

After re-investigating my code, I realized what was going on here. For this particular project I wasn't using the API key and access token of my own application; I'm using the ones I sniffed from the communication between the Stack Exchange mobile app and the API. The Stack Exchange mobile app has an unlimited quota, it seems.


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.


6

Markdown. While you could use HTML (just like you can in posts), each time you use HTML instead of Markdown to format a post, Evan Carroll rapes a little kitten and sticks another needle in his Jeff Atwood voodoo doll.


6

Your value for channelUrl is nominally correct. If I set up my XAMPP server, via httpd.conf to use port 8000, then this HTML page works perfectly fine for me: <!DOCTYPE html> <html><head> <title>StackApps SDK auth test</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head><...


6

You don't explicitly need permission, but you must follow certain rules and legal requirements. Refer to Jeff Atwood ♦'s answer to "Etiquette of Screen-scraping Stack Overflow?": We regularly block (IP range ban) unknown scrapers that do not identify themselves and/or have poor behavior patterns. These bans are permanent until someone emails us to make a ...


6

Okay, went ahead and banged out a script for this; Happy Christmas! To install, click here (SE Edit Reasoner install at Github). To preview the source, click here (SE Edit Reasoner preview at Github). This userscript requires an engine that supports both @require and the various @granted APIs. It was tested on Firefox + Greasemonkey and Chrome + ...


6

It's pretty easy to get the bibtex, just send a GET request formatted like so: https://mathoverflow.net/posts/{POST NUMBER}/citation For example, for this Math Overflow question, you can get the bibtex for the question and top 2 answers with: mathoverflow.net/posts/105922/citation (Question) mathoverflow.net/posts/105930/citation (Answer 1) mathoverflow....


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