var context = new Soapi.ApiContext(yourApiKey);
Soapi.JS 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 library, providing a seamless view on the data served by the API.
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).
A beta version available at http://soapi.info/Downloads/Soapi.JS2-beta-09-17-2010.zip.
- 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.
- Minor code improvements
- Added JS2+CS UserIndexer and UserFinder demo to Soapi.CS samples (the Soapi.JS2 source lives with Soapi.CS)
- Added Soapi2.Contrib.js to support samples
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.
- 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.
- Removed linq.js integration. The convenience was outweighed by the limitations imposed. It was a bad design decision in the first place. Simply create
Enumerablewhen you need it by
- 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
- completed preliminary documentation (
- adjusted default throttle to 30 per 6.5 as per current API tolerance
- merged scripts
- made throttle/cache optional
- added RepReport sample
- implemented ThrotteCache
- implemented paging fully
- implemented .total method
- initial release
- 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 and add a comment or answer.
Included in the alpha ZIP file is a full coverage test suite and a rather detailed walkthrough.
- 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..
- Basic Usage Example 01 - demonstrates how to retrieve related data from the API using Soapi.JS2
- RepReport - an example of using Soapi.JS2 to provide a custom view on your reputation points 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.
Apps that use Soapi.JS2
- StackCenter - Your One Stop for Everything Stack Exchange
- insert your app here (or leave a comment and I will do it)
- Linq.js - This is highly recommended reading for anyone working with Soapi.JS2. Most sample code I provide will leverage this amazing little library.
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?