Hot answers tagged mono
3
Soapi.CS Fluent Configuration
var ctx = new ApiContext(ApiKey).Options
// obviates a call to stackauth
.SerializedSites("{ 'api_sites': [ {'name': 'Stack....")
// can also be accomplished by seeding the cache
.SeedCache(new RequestCacheItem
{
Uri = new Uri("http://stackauth.com/1.0/sites"),
ResponseText = "{ ...
3
Asynchronous Requests
Async requests can be made using the Site's RouteFactory.
A salient use case for this functionality is using Soapi in Silverlight.
[TestMethod, Asynchronous]
public void AnswersByIdTestValid()
{
// The thing to be aware of is that the IEnumerable, lazyloading
// model is synchronous, and since we are on the UI thread here
...
2
Soapi.CS Paged Results
Pay particular attention to the third example; thats all 2800+ stack apps users in less than 5 seconds without breaking any rules. not too shabby.
// Soapi elegantly handles multi-page requests.
// Multi-paged requests are issued in parallel making data retrieval quick
// get the default, 1 page of 30 using default sort
var ...
2
Soapi.CS Full API Coverage
// instantiate a context
ApiContext ctx = new ApiContext("qgAq_KfDu0KYzlNG-qaTuw");
ctx.Initialize().AsyncWaitHandle.WaitOne();
// get a site
Site sofu = ctx.Official.StackOverflow;
// or
Site stackapps = ctx.Sites.First(s=>s.ApiEndpoint == "http://api.stackapps.com");
---
// StackAuth Routes
// /sites ...
2
Soapi Caching and Throttling
Throttle
All API requests made by Soapi are routed first through Soapi.Net.RequestCache and failing a cache hit, they are then routed through Soapi.Net.RequestThrottle.
The throttle, which is described in detail here, works on a sliding window, allowing maximum request rate up to the prescribed limits, currently 30 per 5 ...
2
MakerOfThings7:
Why is SOAPICS GPL? That really limits it's usage. Can you change it to LGPL?
http://soapics.codeplex.com/license
My application is proprietary, and the GPL license requires that I distribute source of my app if I simply link to this library. That's a no-go for me.
code poet:
There are many reasons that this, and other libraries, are ...
2
Soapi.CS - Full Parameter Parity
Soapi provides full API coverage including parameters.
[Test]
public void info_param()
{
// /questions
SO.Questions
// answers (optional) When "true", the answers to a question will be returned
.WithAnswers(true)
// body (optional) When "true", a post's body will be included in the ...
2
Bulk Data Import
This is a simple example of using Soapi.CS for bulk data importation.
This sample creates/updates a SQLite database with the the complete profile of all Stack Exchange users with reputation >= 100 and assigns a rank according to order of appearance.
Soapi processes the ~1000 requests required in less than 5 minutes.
You may run this ...
1
Building a simple app with Soapi.CS
Suppose you would like to build a complete dataset containing all of your content and activity for all of your accounts on all Stack Exchange sites.
You would need to:
Get a list of your accounts from stackauth /users/{id}/associated
For each account
Get all of your questions
Get all of your answers
Get all of your ...
Only top voted, non community-wiki answers of a minimum length are eligible