var context = new Soapi.ApiContext(yourApiKey);
context.initialize(function() {
context.official.stackApps
.Users().ById(14)
.invoke(function(users) {
alert(users[0].display_name);
});
});
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 ( docdocumentation data is 5mb5 MB so you may wish to access the help file from the download).
A Betabeta version available at http://soapi.info/Downloads/Soapi.JS2-beta-09-17-2010.zip.
- JavaScript implementation differences break the throttle on webkit browsers on linux/osxLinux and Mac OS X
- minor code and documentation improvements
- added sync initialize with jsobJSON
- implemented live samples in docsdocumentation (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 docsdocumentation. Now that the major code churn is over, I will be sprinkling relevant live samples througoutthroughout the docsdocumentation.
- minorMinor code improvements
- addedAdded JS2+CS UserIndexer and UserFinder demo to Soapi.CS samples (the Soapi.JS2 source lives with Soapi.CS)
- addedAdded Soapi2.Contrib.js to support samples
implementedImplemented minification to build process. soapi2.js is minified, soapi2.debug.js is commented and also acts as VS intellisensea Visual Studio IntelliSense source. No need to reference it, just let it sit in the same dirdirectory as the references Soapi2.js.
theThe minified size is still around 75k75 KB. Sorry, sorrythere is not much I can do as it is mostly public function and type names. IfIf your server supports serving content gzipped it comes down to about 15k15 KB which is not too bad.
- replacedReplaced Soapi.enableLogging and Soapi.disableLogging with Soapi.set_logCallback to reduce coupling and enable programmatic processing of Soapi events. See Soapi.log in the docsdocumentation for more infoinformation.
- removedRemoved 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)
- implementedImplemented Soapi.Interop (JS2->CS upload) expect dedicated post shortly.
- completedCompleted Soapi apiAPI documentation - started adding content
- addedAdded SyntaxHighlighter functionality to docsthe documentation
- added apiAdded API compatible custom JSON implementation
- completed preliminary documentation (/docs/index.htm
/docs/index.htm
)
- adjusted default throttle to 30 per 6.5 as per current apiAPI tolerance
- Windows - all current major browsers tested
- Linux - FFFirefox and Chrome test good. Opera has issues.
- OSX - FFFirefox, Chrome and Safari test good. Opera has issues.
Apparently Opera on OSXMac OS X and Linux burns oil. The library performs as expected but the internal throttle does not so caveat emptor until notified otherwise.
Included in the alpha zipZIP file is a full coverage test suite and a rather detailed walkthrough.
- Basic Usage Example 01 - demonstrates how to retrieve related data from the apiAPI 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.
- StackCenter - Your One Stop for Everything StackExchangeStack Exchange
- insert your app here (or leave a comment and I will do it)
So, if you would like to upvote the documentation, please do so in moderation, perhaps no more 3three or 4four votes per day?