site title

Topic: API

Stack Exchange API V2.1

09-04-12 by Kevin Montrose. 13 comments

There’s been a low-key beta of the latest Stack Exchange API revision, V2.1, under way for the last month or so.  I’m happy to announce that it’s official, API V2.1 is public, frozen, and out the door.

What’s new in this release?

  • Full Reputation History
  • Notifications Tab
  • Improved Search
  • User Merge history

Oh, and our first set of write methods.

It’s now possible to create, edit, and delete comments via the Stack Exchange API

We’re starting small, with the least important of our content, to safeguard the quality of our content.

Comments created with the API show which app created them when you hover over them, like so:

The link shown will take you to an app’s Stack Apps post, letting you find new apps right from your favorite sites (as well as report malicious ones easily).

The following restrictions apply to the write comment methods:

  • Your app must have an undeleted Stack Apps post
  • Your app must be authorized by a user to perform write operations
  • The authenticated user must have the comment everywhere privilege
  • A user’s daily quota of write operations increases with reputation

So head on over to the documentation and

Get Started

Stack Exchange API V2.0 Contest Winners

04-10-12 by Kevin Montrose. 7 comments

About six months ago we began work in earnest on the second version of the Stack Exchange API.  A few months later, after a short private beta, we opened up a public beta with tantalizing prizes.

Now it’s time to announce the winners.

First Prize – Stack Remote

Stack Remote

An Android app by Karan M, supporting all non-meta Stack Exchange sites and a view into your inbox.

Karan will be getting an iPad 2 the new iPad.

Second Prize – SENotifier

SENotifier

This open source app by Greg Hewgill drops your new inbox items into OS X’s menu bar.

Greg will be getting an Acer Aspire One.

Third Prize – Stack Alert

Stack Alert

A series of open source browser extension for Google Chrome, Mozilla Firefox, and Opera by George Edison which pull your inbox into the browser.

George will be getting a 160 GB Intel SSD.

Library – Serel

Serel

An open source Ruby library written by Thomas McDonald, check out the documentation.

Thomas will be getting a Kindle Fire.

Bug Reports

George Edison

Jonathan.

agent86

All these users contributed a substantially to the quality of the API by finding and reporting numerous bugs, and will be getting their choice of a Lilliput Mini USB Monitor and a Kindle Touch 3G.

But wait, there’s more!

As part of the new authentication feature in Stack Exchange API V2.0, we added an apps tab on user profiles for managing app permissions.

 

Up until now, this tab was only visible to users who had authorized at least one application.  Starting today we’ve made it visible to all users, and put some tasteful app suggestions in there for users who haven’t authorized any apps yet.

We’re doing this to help those developers who build on our API find an audience for their hard work, in a similar vein to Community Promotion Ads.

Here are the current guidelines for getting an app listed:

  • It must be free, and thus available to all our users
  • It must be listed on Stack Apps
  • It must work on all Stack Exchange sites
  • It must be awesome (we’re hand curating these for now)

Congratulations to all the winners

You should definitely check them out.

If none of these apps float your boat there are plenty more available on Stack Apps, or you could jump in and build your own.

Stack Exchange API V2.0 No Longer Beta

02-03-12 by Kevin Montrose. 8 comments

We’ve spent the last month polishing V2.0 of the Stack Exchange API in a public beta, and I’m happy to announce its final release.  Kudos to those who have reported bugs, and made quality suggestions during the beta.

At this point the interface to V2.0 is frozen, only bug fixes and performance improvements will be deployed until the next revision.  As always, if you build on our platform we will support you so V2.0 will be around as long as it sees significant use.

You’ll find our revamped documentation portal at:

api.stackexchange.com

Alongside the documentation for every method, you’ll also find a test console for rapid experimentation.  Try out the console by finding Jon Skeet’s most recent comment.

We’ve also thrown together a minimalist Javascript SDK for consumers that just want to use the new authentication features.

Although the beta is over, the contest continues.  You have until the end of February to list any application or library on Stack Apps to be eligible, and you can continue to hunt the (now rather elusive) bugs left in the API.

Some Neat Apps That Are Already Available

StinkingBadges, created by agent86, lets you see your progress towards some of the harder Stack Exchange badges.  It’s a good example of filling a gap, rather like StackPrinter from V1.0.

Stack Alert, created by George Edison, takes advantage of the headlining authentication feature of V2.0 to give you access to your Stack Exchange inbox right in your browser.  While decidedly utilitarian, it is already available for Firefox, Opera, and Chrome.

StackGeography, created by patridge, plots where on the globe new questions are being asked.  Not entirely unlike our own monitor wall, but built on top of the public API.

While it’s only half-way through the contest, I’m pretty pleased with what I’ve seen thus far.

Of course, there’s plenty of time left to create an application.

If you’re interested go read the read the documentation and register your application.

Stack Exchange API V2.0 Public Beta

12-26-11 by Kevin Montrose. 7 comments

More than a year and a half ago we unveiled the first version of the Stack Exchange API to the wider world.  Since then we’ve had a minor point release, improved app and script listing, and shared some statistics about the consumers of our API.

I’ve been pretty pleased with version 1.1, stackexchange.com and our chat software make extensive use of it, there are a good number of useful applications listed, and a couple of parties are pulling interesting statistics out using it.  It’s been a success, but the shine’s definitely come off; there are some use cases we didn’t support, some missing features, and just some plain-old mistakes.

That’s why I’m pleased to announce…

The public beta for Version 2.0 of the Stack Exchange API

We’ve been consuming this internally for a bit, and a rather low-key private beta has been going on for the last few weeks.  With any luck we’ve flushed out any really bad bugs and functional deficiencies.

If you want to hop right in, go take a look at the documentation and then register an app.

Just like last time, we’re running a contest to encourage some applications that exercise the sweet new features in V2.0.

First Prize

For the most awesome application, you’ll get an iPad 2.

Second Prize

Second place will get an Acer Aspire One.

Third Prize

For third place, a 160 GB Intel SSD.

Library

We’ve tried to make the API easy to understand and use, we’re aware of the great advantages of wrapping some complexity away in a library.  Building an awesome library makes it easier for future developers to get up and running against our API.

The author of the best library will get a Kindle Fire.

Bug Reports

Even if you don’t have any app ideas, and can’t afford to invest the time needed in building a full library, you can still participate in the contest.  Each bug you find makes the API a little bit better for the rest of the community.

Those who we feel have contributed substantially to the quality of the API with their bug reports will get to choose between a Kindle Touch 3G, or a Lilliput Mini USB Monitor.

 

The Rules

  • Contest open to every man, woman, and child on planet Earth, except those men, women, or children living in places where contests like this are somehow illegal.
  • Only applications and libraries/wrappers listed on the apps tab of stackapps.com are eligible for consideration.
  • The application or library/wrapper must be written using our API, and work against all of our sites.
  • Libraries must expose all available methods in the API in some fashion.  I’d advise comprehensive examples to make it clear you’ve covered everything.
  • While we do have a prize to recognize the best library/wrapper, to be eligible for the first 3 prizes you must build an application.
  • If you live in an area of the world where it is logistically impossible for us to get your prize to you — like, say, because your nearest Apple retailer is 3000 nautical miles away — we’ll make something work.
  • Your app must work against the final, 2.0 released version of the API.  The “beta” moniker will have come off the API before the contest ends.
  • If your app depends on an app store for distribution, you must have some way of getting the app to us to judge if it is not yet approved when the contest ends.  We’ll contact you to get a copy, but you’ve got to get our notice first so put some real effort into your Stack Apps post.

We’ll be judging apps based on how awesome and useful we, the rapidly increasing employees of Stack Exchange, find them.

The library prize will be chosen by the development team, and who knows we may pull it into our projects (as Stacky, the previous winner, was into stackexchange.com).  While we don’t care about platform, we do care about documentation and examples, so make yours exemplary.

The bug report prizes will be sent to anyone we feel went above and beyond in finding bugs in the API, there’s no limit to the number of people who may win.

All entries must be listed on Stack Apps by 11:59 PM UTC February 29th, 2012, we’ll be judging entries in the first few weeks of March and announcing winners subsequently.

Stack Exchange API Usage Stats and API 2.0 Plans

09-29-11 by Jeff Atwood. 7 comments

Stack Exchange has a very full featured, albeit currently read-only, API. You can view some of the nifty applications people have created with the Stack Exchange API in the app gallery on Stack Apps, or check out the winners of the Stack Exchange API contest we held last year.

We’re currently in the planning stages for Stack Exchange API 2.0. There’s a draft API 2.0 specification on Stack Apps, so head on over there and take a look if you want a voice in that process.

As a part of our research process leading up to 2.0, we analyzed usage statistics of the API to date. For the period from 8/21/2011 to 9/21/2011 inclusive, there were 34.2 million requests against the API. That’s about 12 requests per second.

API usage skews heavily toward users and questions:

The top API calls, by volume, are:

/users/{ids}/timeline 7.8m
/users/{ids} 5.2m
/users/{ids}/mentioned 4.2m
/questions 3.4m
/questions/{ids} 3.0m
/users/{ids}/questions 2.9m
/questions/{ids}/answers 1.7m
/users/{ids}/reputation 1.3m
/users/{ids}/answers 1.3m
/posts/{ids}/comments 1.3m
/answers 463k

There’s a precipitous drop in usage after that. It’s somewhat surprising just how user centric the queries are, given how Q&A focused Stack Exchange sites are. This suggests that user authentication to get to the tiny bit of hidden user information we have really will be a popular feature — and that is slated for API V2.0.

Approximately 6% of API traffic is the result of internal Stack Exchange requests. Chat made approximately 1.1m requests, stackexchange.com made about 250k requests, and careers.stackoverflow made approximately 140k requests. Only Chat actually requires the raised API request limit that we give it.

The top applications by API usage are:

StackApplet 5.3m
Newt 5.2m
Stack Exchange Notifier 3.5m
StackGuru 1.4m
Question Monitor 1.3m
Stack Overflow Chat 1.1m
New Q! 943k
VSCommands Lite 572k
SO Live! 535k
Droidstack 498k
Coding Clue 473k
StackMobile 443k
StackTack 386k
StackMonitor 356k
StackAnywhere 291k
AskUbuntu Add-on 251k
stackexchange.com 251k
Swatch for Firefox 185k
DFeed IRC bot 180k
Area 51 142k
Careers 140k
StackTrends 128k

Roughly 59% of all API requests are from non-web applications. Of the top 20 applications, 8 are non-web applications. This is of some interest with regards to the debate around HTML encoding all output by default, to ensure it is HTML safe. This suggests that there are many opportunities for script injection, although the reach of the attack is somewhat mitigated.

API usage growth is basically flat. This is not terribly surprising, since we’re read-only until API v3.0.

Getting cache hit rates out of our logs is a bit difficult, but we’ve got an upper limit of 10% based on the numbers. I’d say we can be confident in a 3-5% cache hit rate.

We hope these statistics are interesting, if for nothing else than learning about some useful apps that work with the Stack Exchange API that you might not have heard of. You can find out more about these apps, and discover a bunch more, at Stack Apps!

Stack Apps is more than an app (and script) directory — there’s also a comprehensive set of documentation, support, and examples for the Stack Exchange API over at Stack Apps — and the entire API is self-documented at …

api.stackoverflow.com/1.1/usage

… with examples you can run directly in your browser. And naturally, it works against every Stack Exchange site exactly as you’d expect!

Thanks to everyone who has built apps against our API. We’ll do our best to support you, and keep evolving the API to add more awesome for you.