##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][1] as it is a completely different take on accessing the API via JavaScript. [Soapi.JS][2] is a very lightweight library that provides full API coverage. Soapi.JS2 takes it to version 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][3] 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 (documentation data is 5 MB so you may wish to access the help file from the download). ###Download A ***beta*** version available at [http://soapi.info/Downloads/Soapi.JS2-beta-09-17-2010.zip][4]. **Known Issues:** - JavaScript implementation differences break the throttle on webkit browsers on Linux and Mac OS X **ChangeLog:** Soapi.JS2-beta-09-17-2010 - minor code and documentation improvements - added sync initialize with JSON - **implemented live samples in documentation** (Soapi.JS2.docs.htm) - just a key handful so far, but it is pretty helpful to see a code snippet that you can run right there in the documentation. Now that the major code churn is over, I will be sprinkling relevant live samples throughout the documentation. Soapi.JS2-beta-09-09-2010 - Minor code improvements - Added JS2+CS UserIndexer and UserFinder demo to [Soapi.CS][5] samples (the Soapi.JS2 source lives with [Soapi.CS][5]) - Added Soapi2.Contrib.js to support samples Soapi.JS2-beta-09-06-2010 - Implemented minification to build process. soapi2.js is minified, soapi2.debug.js is commented and also acts as a Visual Studio IntelliSense source. No need to reference it, just let it sit in the same directory as the references Soapi2.js. - The minified size is still around 75 KB. Sorry, there is not much I can do as it is mostly public function and type names. If your server supports serving content gzipped it comes down to about 15 KB which is not too bad. Soapi.JS2-beta-09-05-2010 - Replaced Soapi.enableLogging and Soapi.disableLogging with Soapi.set_logCallback to reduce coupling and enable programmatic processing of Soapi events. See Soapi.log in the documentation for more information. 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 the documentation - 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][6] 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. - Windows - all current major browsers tested - Linux - Firefox and Chrome test good. Opera has issues. - OSX - Firefox, Chrome and Safari test good. Opera has issues. Apparently Opera on Mac OS X and Linux burns oil. The library performs as expected but the internal throttle does not so caveat emptor until notified otherwise. Remember, we are still in beta. Soapi.JS2 will be fully compatible with all common browsers on all platforms before RC1. If you would like to provide compatibility feedback, you may run the [integration test suite][7] and add a comment or answer. ##Contact code poet ##Code Included in the alpha ZIP file is a full coverage test suite and a rather detailed walkthrough. ###QuickStart - [ApiContext][8] - the root of all queries <-- **start here** - [Api Coverage][9] - how Soapi.JS2 maps to the API - [Relational Queries][10] - how to treat the API like a database - [Async usage pattern][11] - how to call and what to expect - [Parameterization And Paging][12] - how to get exactly what you want from the API - [Stubs][13] - filling placeholder objects - [Throttling and Caching][14] - concentrate on features, not plumbing.. ###Sample Code - [Basic Usage Example 01][15] - demonstrates how to retrieve related data from the API using Soapi.JS2 - [RepReport][16] - an example of using Soapi.JS2 to provide a custom view on your reputation points data. - [SiteMonitor][17] - an example of using Soapi.JS2 to retrieve and display status and statistics for all of the sites in the Stack Exchange network. ###Apps that use Soapi.JS2 - [StackCenter][18] - Your One Stop for Everything Stack Exchange - insert your app here (or leave a comment and I will do it) ###Reference - [Linq.js][19] - 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 three or four votes per day? --- [1]: http://stackapps.com/questions/494/soapi-js-v1-0-fluent-javascript-wrapper-for-the-stackoverflow-api [2]: http://stackapps.com/questions/494/soapi-js-v1-0-fluent-javascript-wrapper-for-the-stackoverflow-api [3]: http://stackapps.com/questions/386/soapi-cs-a-fully-relational-fluent-net-stack-exchange-api-client-library [4]: http://soapi.info/Downloads/Soapi.JS2-beta-09-17-2010.zip [5]: http://stackapps.com/questions/386/soapi-cs-a-fully-relational-fluent-net-stack-exchange-api-client-library [6]: #1448 [7]: http://soapi.info/Code/JS2/latest/Tests/Tests.Integration.html [8]: #1441 [9]: #1436 [10]: #1437 [11]: #1435 [12]: #1440 [13]: #1438 [14]: #1448 [15]: #1434 [16]: #1459 [17]: #1460 [18]: http://stackapps.com/questions/1114/stackcenter-your-one-stop-for-everything-stackexchange [19]: http://linqjs.codeplex.com/