Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

enter image description here

About

Stack.JS is the JavaScript equivalent of Stack.PHP and aims to replicate the request structure of that library as much as possible. The library is still a long ways from being complete but is functional at this point. As was the case with Stack.PHP, Stack.JS is 100% fully documented and comes with a test suite to make sure the library functions as documented.

Request throttling was just added and there are plans to implement a cache.

Code Snippet

var site = API.Site('stackapps');

var response = site.Questions([1, 2, 3]).SortBy('creation_date').Exec();

response.Fetch(function(data) {

    for(var i=0; i<data['items'].length; ++i)
        console.log(data['items'][i]['title']);

});

License

Stack.JS (like Stack.PHP) is released under the MIT license.

Download

You will need to check out the code from the repository (see below) until an official release is made.

Platform

Stack.JS will run on all major browsers (IE, Firefox, Chrome, Opera, and Safari). Currently, I am running the tests in Chrome.

Contact

I can be reached at admin@quickmediasolutions.com.

Code

The code is located at http://launchpad.net/stackjs. You can check it out using Bazaar by running these commands in an empty directory:

bzr init
bzr pull lp:stackjs
share|improve this question
    
I'm wondering how I would implement using this library code to get all the three-letter tags on a site. –  hippietrail Jan 24 '12 at 16:54
1  
@hippietrail: Here is an example using the latest code in trunk: paste.ubuntu.com/815630 –  Nathan Osman Jan 24 '12 at 18:45
    
Is there a URL where we can "include" the latest version in a script tag, like jQuery has? And the same for a minified version? –  hippietrail Jan 24 '12 at 18:52
1  
@hippietrail: not yet, though that is planned. In the meantime, feel free to use this: files.quickmediasolutions.com/temp/stack.min.js Keep in mind that the library is still in its early stages. –  Nathan Osman Jan 24 '12 at 18:58
    
I just tried running it in jsfiddle and after some time I got my first ever API error! {"error_id":502, "error_name":"throttle_violation", "error_message":"too many requests from this IP"} –  hippietrail Jan 24 '12 at 19:17
    
@hippietrail: Hmm... sounds like the request throttling needs some more work. Edit: okay, I've made some adjustments. Please try it again. –  Nathan Osman Jan 24 '12 at 19:56
    
Had to wait for my ban to expire. Same problem still though! It seems you're not setting a page size, which could be up to 100. –  hippietrail Jan 25 '12 at 19:45
1  
@hippietrail: That's very strange. I will look into this and let you know when this gets resolved. –  Nathan Osman Jan 25 '12 at 20:43
    
OK that problem seems to be solved. But now I can't figure out how to get the list of all 3-letter tag synonyms. The obvious way of just chaning Tags in the code to Synonyms didn't work and I couldn't find much useful documentation other than the source code. –  hippietrail Sep 7 '12 at 11:40
add comment

You must log in to answer this question.

Browse other questions tagged .