Skip to main content
11 of 18
added 77 characters in body
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

Soapi.JS2 : a fully relational JavaScript client library for the Stack Exchange API - beta preview

##Soapi.JS2

   var context = new Soapi.ApiContext(yourApiKey);
 
    context.initialize(function() {
         
        context.official.stackApps
        .Users().ById(14)
        .invoke(function(users) {
 
            alert(users[0].display_name);
        });
    });

##About

Soapi.JS2 is being released separately from Soapi.JS as it is a completely different take on accessing the API via JavaScript.

Soapi.JS is a very lightweight library that provides full API coverage.

Soapi.JS2 takes it to 11 with a complete paradigm shift. It is a bit heavier and revolves around a fluent, relational query approach similar to that of the Soapi.CS library, providing a seamless view on the data served by the API.

###License

MIT-X11/GPL

###Documentation

The documentation is available in the download or can be viewed online here: http://soapi.info/Code/JS2/latest/docs/index.htm ( doc data is 5mb so you may wish to access the help file from the download)

###Download

Beta version available at http://soapi.info/Downloads/Soapi.JS2-beta-08-29-2010.zip

ChangeLog:

Soapi.JS2-beta-08-29-2010

  • removed linq.js integration. The convenience was outweighed by the limitations imposed. It was a bad design decision in the first place. Simply create Enumerable when you need it by Enumerable.From(item)
  • implemented Soapi.Interop (JS2->CS upload) expect dedicated post shortly.
  • completed Soapi api documentation - started adding content
  • added SyntaxHighlighter functionality to docs
  • added api compatible custom JSON implementation

Soapi.JS2-beta-08-25-2010

  • completed preliminary documentation (/docs/index.htm)
  • adjusted default throttle to 30 per 6.5 as per current api tolerance

Soapi.JS2-beta-08-19-2010

  • merged scripts
  • made throttle/cache optional
  • added RepReport sample

Soapi.JS2-alpha-08-21-2010

  • implemented ThrotteCache

Soapi.JS2-alpha-08-20-2010

  • implemented paging fully
  • implemented .total method

Soapi.JS2-alpha-08-19-2010

  • initial release

###Platform

JavaScript - Any browser that doesn't burn oil.

##Contact

code poet

##Code

Included in the alpha zip is a full coverage test suite and a rather detailed walkthrough.

###QuickStart

  • ApiContext - the root of all queries <-- start here
  • Api Coverage - how Soapi.JS2 maps to the API
  • Relational Queries - how to treat the API like a database
  • Async usage pattern - how to call and what to expect
  • Parameterization And Paging - how to get exactly what you want from the API
  • Stubs - filling placeholder objects
  • Throttling and Caching - concentrate on features, not plumbing..

###Sample Code

  • Basic Usage Example 01 - demonstrates how to retrieve related data from the api using Soapi.JS
  • RepReport - an example of using Soapi.JS2 to provide a custom view on your reputation data.
  • SiteMonitor - an example of using Soapi.JS2 to retrieve and display status and statistics for all of the sites in the Stack Exchange network.

###Reference

  • Linq.js - This is highly recommended reading for anyone working with Soapi.JS2. Most sample code I provide will leverage this amazing little library.

##PLEASE NOTE: I try to provide quality documentation and I do appreciate the approval indicated by upvotes, but the Stack Overflow anti-vote fraud system is silently reversing votes cast in rapid succession.

So, if you would like to upvote the documentation, please do so in moderation, perhaps no more 3 or 4 votes per day?


Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60