###Basic Usage Example 01
var ctx = new Soapi.ApiContext(apiKey);
ctx.initialize(function() { // ctx.initialize loads sites from stackauth
var site = ctx.find("api.stackapps.com"); // site is Soapi.Domain.Site
// if you are using Visual Studio, you can use the constructor of any domain '
// object as a Cast operation to enable intellisense...
site = new Soapi.Domain.Site(ctx.find("api.stackapps.com"));
// data is fetched via intuitively named query methods rooted on the site
// lets start out with a _simple_ example
var example_01 = document.getElementById("example_01");
var list = document.createElement("ul");
example_01.appendChild(list);
site.Users().invoke(function(users) { // get a page of users
users.ForEach(function(user) {
// add a list item for the user
var userListItem = document.createElement("li");
list.appendChild(userListItem);
userListItem.innerHTML = user.display_name;
// add a nested list to hold the user's questions
var userQuestionsList = document.createElement("ul");
userListItem.appendChild(userQuestionsList);
// get a page of the user's questions
user.Questions().invoke(function(questions) {
questions.ForEach(function(question) {
// add the question
var questionListItem = document.createElement("li");
questionListItem.innerHTML = question.title;
userQuestionsList.appendChild(questionListItem);
});
});
});
});
});
Output
- George Edison
- My reputation graph is messed up.
- How to retrieve notifications for a given user.
- StackList - List Your Apps, Track Bugs, and More!
- StackAd Scroller
- Can we have a test user account?
- StackCenter - Your One Stop for Everything StackExchange
- Game developer's logo isn't working.
- Game Developers Meta is not working at all.
- When does the judging take place?
- StackApplet - StackOverflow Meets the Gnome Desktop [v1.2 released!]
- Can there be a way to find a user given his email hash?
- StackMobile.com - View StackExchange Sites on Your SmartPhone
- so++ - C++ Library
- StackApps API is down.
- StackImage - Generating Images of Questions and Users
- List of example questions.
- Standardized set of sort icons?
- Why I think Area51 needs an API.
- How will the popularity of hosted apps be determined?
- stack.PHP - Clean, Easy to Use Wrapper for PHP
- Where are the new Metas?
- Can we add a creation_date to the /sites method?
- Could there be a way to check stats on a key?
- When does a rate-limit day start and end?
- Problems with the Site Icons
- Confusion over my API key
- Can we have some sort of notification system?
- Can StackAuth indicate whether a linked meta is in private / public beta?
- Timeline for v2.0 of the API?
- Version 1.0 of the API seems to be here!
- Kevin Montrose
- World's Worst StackOverflow Clone
- Getting your [app] to show up in the AppStore
- Url length limits have been increased
- Request Throttling Limits
- How the /sites method is meant to be used
- Getting Started with the API
- API Documentation and Help
- Version 1.0 released 9th of July
- Observe a private beta in StackAuth
- API Version 0.9, Release Candidate
- Supported Platforms
- Conscientious use of the API
- How API Keys Work
- code poet
- Soapi.JS2 - a whole nother thang. alpha preview.
- /users/{id}/reputation != xxx.com/reputation
- How to generate a list of users ranked by bug report submissions.
- How to generate a list of users ranked by activity (question or answer count).
- How to calculate a list of users ranked by question favorite count totals.
- How to calculate a list of users ranked by question score (votes sum) totals.
- How to calculate a list of users ranked by question view count totals.
- API compliant request throttle implementations
- Simple Activity Monitor - For Educational Purposes only.
- How to batch up multiple id requests to maximize economy and still avoid (400) Bad Request
- How to call the API via JSONP in Plain Old JavaScript
- How to retrieve paged API results in C# and Silverlight
- SOAPI-EXPLORE: Self-updating single page JavaSript API test harness
- SOAPI-WATCH: A realtime service that notifies subscribers via twitter when the API changes in any way.
- /users/{id}/tags - 504 Gateway Timeout
- Soapi.Explore (silverlight) - The entire API at your command
- BOUNTY: Build an app with Soapi.JS and gain praise and adulation. And some rep.
- Soapi.CS : A fully relational fluent .NET Stack Exchange API client library
- /questions/{id}/timeline throwing 500 instead of 404
- How to format reputation numbers similar to Stack Exchange sites.
- How to format time since xxx e.g. "4 minutes ago" similar to Stack Exchange sites
- suggest add favicon.ico to api endpoints
- Soapi.FindUser (silverlight) Quickly find any user anywhere in the Stackiverse!
- Soapi.JS V1.0: fluent JavaScript wrapper for the StackOverflow API
- What is SOAPI and why should I care?
- Soapi.FindUser - Quickly find a any Stack Exchange user
- recommended buffer size for markdown fields is conservative
- /users/{id}/associated - inconsistent behavior
- /users/{id}/answers - broken
- api domain object unique keys
- lfoust
- Stacky - A .Net client library
- nottagged parameter not documented
- systempuntoout
- questions method returns error 4000
- StackPrinter: The Stack Exchange Printer Suite
- On Stackauth /sites new meta sites have wrong name
- How to order /sites result in a user friendly way to use it in our apps.
- Please, keep meta entries on stackauth /sites ordered
- Accepted answer on questions/id/answers method sorted by votes
- errors/{id} documentation : 500 Internal Server Error
- How to format an url-friendly slug for question urls
- Should we add a "this site is not affiliated to Stack Overflow.." disclaimer to our website app?
- Prevent that posts tagged with app or library enter Community Wiki mode when owner edit it 8 times
- Question's title attribute is not HTML encoded
- Possible problem calling users/?filter method searching username with tilde
- On /users method id parameter does not work
- added_date in users/{id}/favorites method result
- Is questions views counter working on Stack Apps?
- API methods that return a single Item by id: unnecessary parameters to remove?
- questions/{id} API method: pagesize parameter?
- Count of API Daily limits on different family sites
- Are Serverfault and Superuser domains officially supported by the API?
... ... and on and on