###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**

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