What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

Note: I'm aware of this question, but it's slightly different, and in my view is talking about the Stack Overflow folks coming up with an API themselves. I'm talking about a community-developed one, hopefully with approval from the Powers that Be.

Currently I'm aware of three ways of accessing Stack Overflow programmatically:

I would personally be interested in:

  • All aspects of user activity. What have I done, when, and what were the results? What reputation did I gain when? Where was I voted down? What proportion of my answers have been accepted?
  • Activity on specific questions and answers - in particular any that I've contributed to (including asking a question, adding an answer, making a comment, or even just voting)
  • Potentially posting in an automated fashion. I can imagine a thick client Stack Overflow application, with offline access, simple lookup of known API resources (e.g. MSDN and Javadoc) and a bunch of other things people might find useful.

The JSON feed is incredibly easy to use - but the others are more of a pain. I suspect if we can put together good use cases for certain aspects of data, we'd have more of a chance of getting a little bit of Stack Overflow developer time to enable certain URLs for JSON data.

I'd be interested in developing this personally, in C#. If there's enough interest it could become multi-language, of course - and obviously it would be an open source project. There are various tools already out there - it would be good to draw the experience together and come up with an API for people to use in interesting ways.

So, what are the other things you'd want an API to be able to do?

share|improve this question

migrated from stackoverflow.com Aug 4 '09 at 20:48

This question came from our site for professional and enthusiast programmers.

    
How does that json work? What's MS? –  Rich Bradshaw Dec 8 '08 at 18:25
    
@Rich: The JSON gives you information about any post which has changed your rep within the given time period: ID, name, positive rep, negative rep. Which "MS" are you referring to? –  Jon Skeet Dec 8 '08 at 20:06
    
You wrote : stackoverflow.com/users/USERID/FROM-MS/TO-MS I think he means what is the -MS ... The Json is already implemented? I do not see where to access it? –  Daok Dec 9 '08 at 13:40
1  
Ah, right. The "MS" is "milliseconds" (I can't remember what the base is, offhand). For instance: stackoverflow.com/users/22656/1222646400000/1222732800000. So yes, there's JSON support - but only for that one use case, I think. –  Jon Skeet Dec 9 '08 at 14:17
    
Oh I really do not like to have to write the millisecond to get information, that's for sure :S –  Daok Dec 9 '08 at 16:16
    
@Daok: Clearly any API would hide that behind a DateTimeOffset or something similar. –  Jon Skeet Dec 9 '08 at 17:06
    
It looks like the millisecond values are counted from 1 Jan 1970 (i.e., unix time * 1000). –  Ben Alpert Jan 2 '09 at 1:02
    
What are you using for your rep tracker, Jon Skeet? If you're using the JSON, how are you able to show non-scoring items? –  Kyle Cronin Jan 15 '09 at 23:27
    
I'm using JSON, but not the URL that the rep graph uses. Geoff Dalgas suggested I use it. I'd rather not give it out without his say-so, but I'll ask him. –  Jon Skeet Jan 15 '09 at 23:31
    
Is this secret API what Jeff alluded to here: twitter.com/codinghorror/status/1117194983 ? –  Kyle Cronin Jan 15 '09 at 23:40
    
Could be. I wasn't actually sure whether it was that or the monthly rep league :) Anyway, Geoff has said I can share, so... I use: stackoverflow.com/users/[user-id]/rep/[from-date]/[to-date] where from-date and to-date are yyyy-MM-dd, and to-date is inclusive –  Jon Skeet Jan 15 '09 at 23:46
    
your first question link is broken –  Jherico May 23 '09 at 1:59
    
@Jherico: It's been deleted. It's still available for those over 10K rep, but I'll remove the link anyway... –  Jon Skeet May 25 '09 at 21:18
    
What is the purpose of having an API? StackOverflow is about questions, answers and comments. I think of "reputation" as a way of recognise the efforts and contributions of people... granting them some privileges accordingly. I don't get WHY any user or thirdparty would want to access this information (well, aside competition about reputation). I'm not criticizing... I just don't get it. –  Romias May 25 '09 at 21:32
    
@Romias: Well, the JSON API available already makes it easier for me to see what's getting voted up and (more importantly) what's getting voted down. That means that if I've made a mistake, I'll be able to find it quickly due to the downvote. Then consider other tools you might want - other applications tailored to answering, for example, with built-in MSDN and JavaDoc link-finders. –  Jon Skeet May 25 '09 at 21:43

23 Answers 23

I would really love an API to be able to view the history of votes that I have cast. I'm writing an application to view my past activity per day, and I find that I upvote things on stackoverflow a couple of times a week, and when I do, it means that I just found an answer to a problem I had; viewing those votes in my application would very quickly allow me to remember what I was doing at the time.

I vote much more often than I ask or answer questions (because most of the time the question was already asked by someone else), and so I'm really interested in votes (and again, my votes) and not questions/answers.

share|improve this answer
    
I've recently been looking for exactly what you are talking about here but found that SEDE does not do it. And I can't see a way to do it with the latest version of the API. Did you find a solution? –  Louis Apr 26 at 0:27
    
Screen scraping is the only option I think, it wouldn't be hard, but I could not resort to it for now (also because of the credentials problem). Since the feature is only a "nice to have" for me, I'm not doing it for now. –  Emmanuel Touzery Apr 29 at 6:58

Two words, Google Wave (make it compatible).

share|improve this answer
2  
I intend to look into this possibility, don't worry :) –  Jon Skeet Jun 14 '09 at 7:26

The API should work just like the main site works.

If you go to

http://api.stackoverflow.com/questions/350248

then you should get a JSON object that represents all of the data related to that question.

The same would go for any Stack Overflow URL:

http://api.stackoverflow.com/questions/tagged/vb.net+winforms

Then, you could expand the API to expose things that the main site does not, like more detailed searching options:

http://api.stackoverflow.com/questions?askedOn<=01-01-2009&voteScore>10
http://api.stackoverflow.com/users?rep>10000&id<=100

Then, API wrappers could be written in different languages. There are plenty of JSON and XML libraries for plenty of languages. So, offering either or both as results from the API queries would be fine.

share|improve this answer

I would love to see an API that exposes the following items in one or more acceptable formats like JSON, XMLRPC, SOAP, and RSS:

Query by tag or note:

  • Most active questions
  • Most voted questions
  • Most active users
  • Most accomplished users
  • Top x questions by tag(s)
  • 0 answer questions
  • 0 vote questions
share|improve this answer
    
+ most active tags + most responses(groupoed by tag) –  Misquamaqus Jan 13 '09 at 15:09

There is already one "API": the JSON flair URL.

I would like to see the minimal improvements to that API that I mentioned in this long-standing feature-request.

share|improve this answer

Please add a crossdomain.xml policy, especially for the read-only parts. That will allow cross-domain access for Flash and Silverlight.

For example, check out the Flickr cross-domain policy: http://static.flickr.com/crossdomain.xml

Here's the full spec:http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html

share|improve this answer
    
And more importantly, Java from 6u10. –  Tom Hawtin - tackline Mar 27 '10 at 4:22

Screenscraping is a nice way and has powerful potentials. If you are a good programmer, its piece of cake. (I can prove it ;).

Of course a proper REST and XML response for every page would be more helpful.

share|improve this answer
    
I guess screenscraping is not welcome by stackoverflow authors, and it also poses a problem of authentication, which is nicely solved by OAuth in the REST API. –  Emmanuel Touzery Apr 8 '13 at 18:17

For the moment I have scraping the HTML with the Reputation Tracker and it would be better with an API for sure.

Thing what would be great:

  • Get your reputation count
  • Get your last reputation variation and a link to the question/answer that has been modified.
  • Get comments after yours own comment

Maybe something like this :

<user id="13509" reputation="15000">
  <posts>
    <post id="350266" upvotes="10" downvotes="3" type="answer"
          accepted="true" comments="4">
      <questionName>What would you want to see in a StackOverflow API?</questionName>
      <link>http://stackoverflow.com/questions/350248/what-would-you-want-to-see-in-a-stackoverflow-api#350266</link>
      <votedatetime>2008-12-07 13:01:00</votedatetime>
    </post>
  </posts>
  <comments>
    <comment question="350266" id="12345">
      <questionName>What would you want to see in a StackOverflow API?</questionName>
      <lastcommentdatetime>2008-12-07 13:05:55</lastcommentdatetime>
    </comment>
  </comments>
</user>

I encourage people to edit this post to add information or change the format It's just a draft.

share|improve this answer
    
Thx for the editing, much better than my first draft! –  Daok Dec 8 '08 at 17:53
    
There's a lot more thinking to go into this - e.g. an ID format of question/answer/comment (where "answer" can be empty if it's a comment on a question, etc). –  Jon Skeet Dec 8 '08 at 17:58
    
Accepted this answer as encouragement for others to contribute to the format etc. –  Jon Skeet Jan 2 '09 at 8:53
    
if upvotes and downvotes are only counting votes that counted towards rep then shouldn't there be a separate attribute for the question/answer's current vote tally including non-counted votes? –  Sam Hasler Jan 13 '09 at 14:55
    
Now that the API is complete, you can now get XML results from the API using this tool that I made. –  uɐɯsO uɐɥʇɐN Sep 19 '10 at 2:41

I like your feature list, it would be really cool if these things were COMET based.

share|improve this answer

Your first two points are things I'd very much be interested in. I haven't really considered use #3, that's an interesting suggestion.

share|improve this answer

It's also possible to fetch the HTML for user badges.

The users page is doing XMLhttpRequests to update the list of users as you type. You can use it to just get the information for one user at a time.

curl -F filter="username_in_lowercase" http://stackoverflow.com/users/browser-filter

eg:

curl -F filter="sam hasler" http://stackoverflow.com/users/browser-filter

returns:

<table style="width:940px; margin-left:20px; margin-top:-10px;">
    <tr>
    <td>

<div class="user-info">

    <div class="user-action-time"><br /></div>
    <div class="user-gravatar32"><a href="/users/2541/sam-hasler"><img src="http://www.gravatar.com/avatar/5377323bbe24824de512a6a077fc77a3?s=32&d=identicon&r=PG" height=32 width=32 /></a></div>
    <div class="user-details"><a href="/users/2541/sam-hasler">Sam Hasler</a><br/><span class="reputation-score" title="reputation score">3,289</span><span title="5 silver badge(s)"><span class="badge2">&#9679;</span><span class="badgecount">5</span></span><span title="21 bronze badge(s)"><span class="badge3">&#9679;</span><span class="badgecount">21</span></span></div>

</div>
    </tr>
</table>        
<div style="float:right; margin-bottom:20px;">
    <div class="pager">

</div> 
</div>

If you want to know your rep and badge count from the command line just use this:

curl -s -F filter="username in lowercase" http://stackoverflow.com/users/browser-filter | grep reputation-score | sed -e "s/<[^>]*>/ /g;s/&#9679;//g"

Currently for me this gives the output:

      Sam Hasler   3,289     5      21
share|improve this answer
    
Shame this still gives the "11.1K" format for reputation over 10,000 :( Nice to know though... –  Jon Skeet Dec 11 '08 at 15:53

What about automatically extraction of high rated source code in order of programming languages to have an overview of extremely good work on code.

share|improve this answer
    
There's no concept of "high rated source code" though - just "high rated answers (and questions)". Someone could have written a brilliant answer tearing apart some really poor code line by line. –  Jon Skeet Dec 9 '08 at 17:07

Shouldn't this been in uservoice? But some searching looks like it will have to be a community project. However, I am sure they will develop an api. Digg took a bit of time before it released an api.

share|improve this answer
    
No, it shouldn't be on uservoice yet - because it's a question for the community to answer about what they want. When we know what we want, we'll know what to ask the SO team. –  Jon Skeet Dec 13 '08 at 7:29

I'd like to be able to see all of my own questions and answers (or those of another user) for a particular tag. It might be nice to see everything you've ever said about C#, for example, or everything Konrad has said about C++, all in one place.

I'd also like to see the most active users for a particular tag. I know "active" doesn't tell us much at this point, since I could easily go in and post bad answers to all 5000+ .net questions, but people don't generally do that. When looking for information on a topic, it would be nice to see who is active in that topic.

share|improve this answer

You can use http://stackoverflow.com/sitemap.xml to get a lot of questions without needing an API.

share|improve this answer
1  
Caveat emptor, opening this link in firefox killed my browser. –  Jherico May 23 '09 at 1:58
    
It's currently (May 2009) a 9.5Mb file. You can download it (right click>save link as). –  pro May 23 '09 at 8:09
    
Or you may have better luck with wget or curl. –  Phil Apr 9 '13 at 1:24

I just sent this email to Jeff. I'll let you know how he responds:

Hello Jeff & Team,

Sometime last night/early morning a change was made to the user profile page that limited the displayed answers to only the 100 highest-ranked. I'm the author of a service that enables users to track what caused their reputation to change, and the new changes have broken the way I captured data from the site.

In addition to the movement to remove the 100-answer limitation, I'd like to also view this as an opportunity to push for a Stack Overflow API. It would save bandwidth on both our ends if the information I needed could be obtained in a condensed, easily parse-able format. I've examined the JSON used to generate the table to the right of the reputation graph and, while it's promising, it's much too limited to replace the lost functionality, in my opinion. For example, it's not possible to get the actual score of a post or track when they are added or deleted. A more generalized API that can hook into a wider array of profile and post data would be greatly appreciated.

I know I speak for many members of the Stack Overflow community when I say that I'm excited at the possibilities for third-party expansion of the functionality and usability of Stack Overflow. However, what we need most at this time is a way to efficiently and reliably access the data needed to power our tools and services.

I hope I can look forward to working with you and my fellow developers to make Stack Overflow the best place to not only ask and answer questions, but for willing members to use our time and talents to give back and improve what the site has to offer.

Thank You.

share|improve this answer
    
Did you get an update? –  nlaq Jan 21 '09 at 9:09
2  
Any response to your letter? –  ahsteele Feb 28 '09 at 22:12

What about a view that would show you if somebody has made a comment on one of your answers so that you can respond to any questions?

share|improve this answer
    
The responses tab does exactly that, but I do agree in principle - everything in the user profile page should be able to be accessed through an API of some sort. –  Kyle Cronin Jan 11 '09 at 6:14

Not directly an API, but I would love to see occasional snapshots of the database made available for research purposes.

share|improve this answer
    
Yes, I approve. I understand it raises some privacy issues but there are a lot of studies to perform. (For instance, I suspect that the number of votes you get decrease very fast after the publication and that there are almost never any vote after 24 h. But I would like to prove it.) –  bortzmeyer Jan 12 '09 at 15:34
    
The only thing one would need to privatize is the list of people who gave the actual votes. AFAIK, everything else is public. I'm planning a nice WikiSym paper if and when Jeff releases thsi info. –  Uri Jan 14 '09 at 1:28
    
There is a Uservoice suggestion for this, with positive response from Jeff: stackoverflow.uservoice.com/pages/general/suggestions/… –  Greg Hewgill Jan 24 '09 at 2:34

Something like

http://api.stackoverflow.com/1.0/searchQuestions?title=Some+Problem

... would return matching questions, and the selected answer or 3 highest voted answers for each question.

share|improve this answer

Enough metadata about the API that services that depend on it could easily be made to depend on a different Q&A site (such as a private version that lets people within a company discuss sensitive issues or issues that have no meaning in the outside tech world).

The advantage would be that when you then build services that depend on the internal version, you can open-source them and the community at large can benefit.

share|improve this answer

Jon, your list is very inclusive and would make it possible to extend SO with essentially any functionality you can imagine.

Personally, I could do with a far more modest API. In fact, the most important feature to me would be a way to get a user's rep based on username, email or OpenID. For extra credit, they could throw in earned badges too, but that's less important to me.

Why this would be made of so much win: A few years back, there was a lot of talk about centralized online systems for reputation management, but nothing really caught on. I see the SO reputation system as a perfect starting point, for the programming/geek community at least, to get the ball rolling.

Imagine your personal blog or web app having access to each user's SO reputation score. You could allow users with rep >= 50 to use HTML in comments; you could give users with rep >= 1000 automatic moderator access on your forums; you could set a higher priority on bug tickets submitted by high-rep users, etc. etc. Effectively, we could turn 'SO rep' into the defacto standard for 'geek cred' online.

It would work just like Gravatar; once you register on a site, it automatically checks SO for a corresponding reputation score, and displays it on the site user's profile page.

There would have to be a system in place to ensure that these API requests didn't overload the SO server, but I'm sure that wouldn't be a problem, given the people who run this place.

share|improve this answer
    
'geek cred': I like it! Where can I get some? ;-) –  Dexter Jun 28 '09 at 18:50
    
Oh man that is an awesome idea. –  Cyclone Dec 26 '09 at 19:32

I would be interested in the following information:

When I see an user, I would like to be able to to know, when did I comment/up-vote or down-vote this user.

I think the user relationship is something that can add value to stack overflow.

share|improve this answer
    
That's certainly interesting - but it might have the unwanted effect of adding feedback, encouraging you to vote the same way again based on the person instead of the content. I'm not saying that would happen, just that it's a risk. –  Jon Skeet Mar 26 '09 at 13:53
    
I think the risk exists, when I can see when userx voted me; That is not what I want, I want to see "Where else have I seen this guy, that I liked", My votes to him, are currently available. But not in a friendly format. –  Lakshman Prasad Mar 26 '09 at 14:13

I would like to be able to have my actions on stackoverflow directly integrated into my Facebook wall. I haven't done any facebook api programming yes so I don't know what that will require on the SO side, but thats what I want.

In addition, I find the question interface sub-optimal. It would actually be nice if I could add stackoverflow as a task repository in eclipse, or access it with an IMAP or NNTP client to view the questions and easily start perusing them starting with the most recently viewed question.

share|improve this answer
    
Maybe as an app... so it shows up. and you can connect your facebook account with the one here. –  Ape-inago Jun 14 '09 at 7:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .