Hot answers tagged

29

Protip: when working with any API that returns JSON, install the JSONView Firefox Extension. By default, Firefox wants to download the application/json content type. This is not very helpful. JSONView changes the behavior so that you view the JSON in the browser, and additionally get syntax hi-lighting and expand/collapse.


17

Remember, you should only publicize your app if it can actually be used! I'm working on an idea for an app. In true "customer development" fashion, I'd like to publish the idea, with a screenshot of what it will look like, to see what kind of reaction it gets and what features people want it to have. It's not difficult to implement, but I'd rather ...


16

Purposefully not shown. The potential for abuse is way too high.


14

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


13

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


11

All api results are gzipped. So what you are looking at is a gzipped binary blob. Simply decompress using a gzip implementation in R.


10

Transfer-Encoding is hop-by-hop, while Content-Encoding is end-to-end. This means that if there is a proxy involved, anywhere, the proxy will see the TE gzip, unzip it, and not necessarily forward the request as TE gzip. So, the choices are CE gzip and always know what you will be getting, requiring logic to decompress the response. TE gzip and never ...


10

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


9

For the API, the day ends 24 hours after your first API call. A single IP address can only make a limited number of requests per day to the API. This limit is determined at first request time, and is dependent upon the presence of an API key.


9

I suspect your problem (as I commented) is XSS related. Try using JSONP instead of raw JSON; we just added support for the jsonp parameter.


9

You need to encode the # character (to %23) http://api.stackoverflow.com/1.0/questions?title=true&tagged=c%23


9

It's a bit of a Catch-22. Work around it by making an app (or script) post for your app (or script), but put "(Placeholder)" in the title and tag it with placeholder. Also, indicate in the post 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)" "A small Stack ...


9

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


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

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


8

Just be reasonable. Trademark law is based on the principle of not confusing "the reasonable person" as to the origin of goods and services.


8

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


8

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.


8

Yeah... These are kind of complicated, but very flexible. They're also getting better docs soon-ish. Basically, min & max are the range of the sorted results to return. So, if you order a list of questions (pick your API method of choice) by votes, you can set min to 5 and max to 10 to only return questions that have a score of at least 5 and no more ...


7

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.


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

As Kevin says, XSS. Try this instead: $.getJSON("http://api.stackoverflow.com/0.8/stats?jsonp=?", function(data){ alert(data.statistics[0]['total_questions']); });


7

You are getting the GZipped stream of the response content. Use DownloadData instead of DownloadString and uncompress the stream before passing it to the JSON deserializer (or whatever you plan to use). Alternatively, you can use the StackOverflow.Net library.


7

Now, I can confirm that changing my IP Address reset rate-limit to 10000 back. So, 10k limit is per IP Address, not globally.


7

A very low friction introduction to the API can be had with SOAPI-EXPLORE. It is always in sync with the current API and provides a documented interface for querying each route. It is a single file JavaScript application and requires no installation and may be right-click/saved or view source/saved and run locally if desired.


7

Historical Note StackList is no longer available - the features that made it an attractive supplement to listing your app here have found their way into Stack Apps itself. This answer remains for historical purposes. Don't forget to also publish your app on stacklist.quickmediasolutions.com (404 Not Found) The site is shaping into a nice ...


7

Dates increase as time advances, so 1293861600 (Jan. 1st 2011) is greater than 946706400 (Jan 1st. 2000). Thus, a descending ordering puts the most recent dates first. Because sorting by dates is much more common than by name, ordering is descending by default.


7

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 http://__HOST__/upload/image: fkey: we'll talk about this token later source: web/computer ...


7

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


6

An IP has a request quota, an application key is used to determine that quota. In answer to your question, 10k.



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