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.

Is there a "Stack Exchange API 2.0 for Dummies" page out there somewhere?

Almost all of the questions on Stack Apps are for 1.0. Everything explaining how to use javascript to parse through the data seems to be obsolete.

I can do oh-so-many queries using the API Documentation, but results are limited to 100 entries, meaning I have to loop through to get multiple pages. For instance, I want to find all comments containing the word 'quit' on The Workplace.

  1. Data Explorer does not contain data for beta sites
  2. The API does not allow you to use WHERE clauses
  3. The API is limited to 100 comments per page

So I can create a query to get comment text, but I can't get a result in any usable format in javascript without copy-pasting each page individually. Even for a beta site, there are almost 25,000 comments. Going through 250 pages manually is doable, but not desirable.

Is there anywhere that explains how to even start going about doing this? If not, can the API page itself allow people to do queries that aren't limited to 100 items per page?

Note: While this may seem patently obvious to a developer, not all members on the beta sites are developers. It is frustrating to see the potential, and just not knowing how to get there due to a lack of information aimed at beginners

In theory, this should be incredibly simple to do.

You write a page counter to increment through the pages while has_more in the object returned stays true. This should be as simple as:

var page = 1
var data = Results("http://api.stackexchange.com/docs/comments#page=" + page + "&pagesize=100&order=desc&sort=creation&filter=!SrhU3k7ZhFX%288mFsML&site=workplace&run=true")
while(data.has_more == true) {
  document.writeln(data.body + "," + data.link);
}

The issue is that the method of getting the results to be a javascript object isn't documented anywhere. In the comments folks are suggesting using a library designed to be deployed on a server which is well beyond the level required to write the actual logic. This is user unfriendly, particularly for communities not based around writing software.

Is there truly nowhere in the Stack Exchange network that explains how to actually use the API beyond the first 100 entries?

share|improve this question

1 Answer 1

AFAIK, no, there's no page like that. What can lower the burden on our entry to the API is using a library for our language of choice (hopefully, yours is included): stackapps.com/questions/tagged/library+api-v2.

I had lots of issues doing my own queries to the API and finally solved it using this one: Stack.PHP - Powerful and Extensive Library for Accessing the Stack Exchange API - Including Full Support for v2.0. And for the technically inclined, studying the library's code may help to fast-forward some personal solution.

share|improve this answer
    
Thanks for the answer, but while those links work great for developers, for amateurs there is a huge barrier to entry. See Stack.JS's instructions for getting the code: "You can check it out using Bazaar by running these commands in an empty directory: bzr init / bzr pull lp:stackjs" Pretty sure this is for power users who are creating a web app and installing on a web server. Not for people trying to gather more than 100 items in a query. –  jmac Oct 23 '13 at 5:22
    
As stated, I can write an API query easily. I know what I need to do to loop through (check if has_more is true, page++, run again). The issue is that there is no documentation on how to actually implement that in, say, javascript. I don't want to use a library (nor do I think I should have to?), I would think that I could just write a loop in a blank HTML page to return all 25k comments I want without having to worry about server deployment or additional libraries. Is there really no resource in the middle? –  jmac Oct 23 '13 at 5:25
1  
@jmac: I don't see why SE should provide you with a complete guide of "using a web API from scratch, including JavaScript basic, AJAX, REST API theory, ...". If you're not a dev, or aren't familiar with that sort of API, you should really use a library. That's what they're for. And study existing code. –  Mat Oct 23 '13 at 5:39
    
Yep, agreed with @Mat, Stack Exchange already provides the API and the documentation, it's the developers work to write blog-posts/tutorials/libraries/sample-code. I guess in the main site this Q would fall in "asking for recommendations"... –  brasofilo Oct 23 '13 at 5:43
    
Perhaps I'm not communicating my point well. Expecting users to be able to use a library to get more than 100 results from an API query sets a very high hurdle compared to the trivial hurdle of creating a query on the actual API site. This blocks a large portion of people from being able to access data useful in improving their site. The process should not be complicated, and if it is that complicated, it should be made simpler. Using a library means understanding the library, which is far more of a hurdle than writing a for loop to go through queries, which even I can do with little trouble. –  jmac Oct 23 '13 at 7:01

You must log in to answer this question.

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