Skip to main content
Commonmark migration
Source Link

##JavaSript / Soapi.JS

JavaSript / Soapi.JS

##JavaSript / Soapi.JS

JavaSript / Soapi.JS

replaced http://stackapps.com/ with https://stackapps.com/
Source Link

using Soapi.JS

using Soapi.JS

Post Made Community Wiki
Source Link
Sky Sanders
  • 12.1k
  • 3
  • 32
  • 60

##JavaSript / Soapi.JS


using Soapi.JS


Soapi.RouteFactory("api.stackapps.com", apiKey) // get all users
.Questions({ pagesize: 100 }).getPagedResponse(function(data) {

    var values = {}, keys = [];
    // add up the view count for each user
    for (var i = 0; i < data.items.length; i++) {
        var q = data.items[i];
        var u = q.owner;
        if (u) {
            if (!values[u.user_id]) {
                keys.push(u.user_id);
                values[u.user_id] = {
                    display_name: u.display_name,
                    view_count: 0
                };
            }
            values[u.user_id].view_count += q.view_count;
        }
    }

    // sort and dump
    var output = "";
    for (var i = 0; i < keys.sort(function(a, b) {
        return values[b].view_count - values[a].view_count;
    }).length; i++) {
        output += values[keys[i]].view_count + " " + values[keys[i]].display_name + "\r\n";
    }

    document.getElementById("output").innerHTML = output;

});

Output:

17354 Kevin Montrose
10669 George Edison
8855 code poet
3417 systempuntoout
3020 Farseeker
2900 lfoust
2253 Franci Penov
1800 Felix
1786 Soviut
1657 S.Mark
1604 Adam Wright
1402 Jedi Master Spooky
1383 Jeff Atwood
1293 Matt S.
1159 Edan Maor
1087 Steffen Opel
1034 carson
1024 Bill the Lizard
977 Dave DeLong
977 Mark Rushakoff
950 Shay Erlichmen
947 Nick Presta
940 Thomas McDonald
918 Dave Swersky
814 Jonathan
812 eWolf
806 swanson
782 Adam
766 Lucas Jones
726 TheHurt
705 johnwards
691 Catchwa
669 Kyle Cronin
664 Jason
638 phsr
624 codeka
602 InfinitiesLoop
588 nabeelmukhtar
568 Yacoby
502 conmulligan
437 Ricky
432 Dennis Williamson
426 radius
420 SztupY
362 Soldier.moth
359 ColinD
353 Igor Zevaka
336 Koning Baard
320 Ryan Brunner
311 jjnguy
298 Greg Bray
297 fukas78
288 Nathan Reed
287 Michael B.
283 iconiK
258 Peter Mourfield
248 RichH
244 blork
238 Casebash
237 Joel Potter
221 ripper234
214 TheKaptain
207 mlaw
207 Lucas McCoy
205 Nippysaurus
203 James A. Rosen
191 Vitaly Polonetsky
188 bpedro
180 Shane
168 Robert Munteanu
158 svick
138 Martin Plante
133 mikej
132 chenyuejie
124 adrianbanks
122 Peter Mortensen
120 Tim Post
119 daltojr
117 magcius
114 Josh Kelley
114 Riduidel
110 Martijn Laarman
108 pufferfish
106 balpha
104 John Bristowe
103 Peter Ajtai
103 Mark Hurd
102 jmoy
97 JL01
95 Maxim Zaslavsky
93 Joe
90 Kevin
86 Roy Tang
86 Robert Cartaino
86 Jan Fabry
86 denny
85 Chacha102
83 James Johnson
81 pierocampanelli
79 Evan
79 Fatal510
76 tsudot
74 arinte
71 Charles Stewart
70 Frank Krueger
69 Jim McKeeth
68 Chris S
67 voyager
65 Dinis Cruz
64 Mattias Konradsson
63 crucible
63 ADB
62 Dan Atkinson
59 theplic
58 Matthew Pelser
56 Alexandre Rafalovitch
56 Artefacto
56 Robert Love
55 chanchal1987
55 Nathan Voxland
52 AidenMontgomery
52 Bidhan Baruah
51 Can Berk Güder
48 Cristian Castiblanco
48 scunliffe
47 Fernando
46 Matt Culbreth
46 DC01
43 user1711
42 Simon Brown
41 Nicolas Raoul
40 C.W.Holeman II
38 zengr
36 Bialecki
36 peter.newhook
36 coobird
34 Vicky
32 RichOrr
30 hvgotcodes
28 Portman
27 Heavy Bytes
25 stacker
23 chalup
22 Shimmy
21 David
20 Ngu Soon Hui
20 Wei Hu
17 Michal
14 tonklon
11 Alienfluid
4 Matt Huggins

Requests generated (elapsed time 3 seconds)

#   Result  Protocol    Host    URL Body    Caching Content-Type    Process Comments    Custom  
1   200 HTTP    api.stackapps.com   /1.0/questions?key=qgAq_KfDu0KYzlNG-qaTuw&pagesize=100&page=1&jsonp=Soapi._internal._callback0  14,494  private     application/json; charset=utf-8 iexplore:7564           
2   200 HTTP    api.stackapps.com   /1.0/questions?key=qgAq_KfDu0KYzlNG-qaTuw&pagesize=100&page=2&jsonp=Soapi._internal._callback1  14,704  private     application/json; charset=utf-8 iexplore:7564           
3   200 HTTP    api.stackapps.com   /1.0/questions?key=qgAq_KfDu0KYzlNG-qaTuw&pagesize=100&page=3&jsonp=Soapi._internal._callback2  15,408  private     application/json; charset=utf-8 iexplore:7564           
4   200 HTTP    api.stackapps.com   /1.0/questions?key=qgAq_KfDu0KYzlNG-qaTuw&pagesize=100&page=4&jsonp=Soapi._internal._callback3  14,012  private     application/json; charset=utf-8 iexplore:7564           
5   200 HTTP    api.stackapps.com   /1.0/questions?key=qgAq_KfDu0KYzlNG-qaTuw&pagesize=100&page=5&jsonp=Soapi._internal._callback4  14,457  private     application/json; charset=utf-8 iexplore:7564           
6   200 HTTP    api.stackapps.com   /1.0/questions?key=qgAq_KfDu0KYzlNG-qaTuw&pagesize=100&page=6&jsonp=Soapi._internal._callback5  4,234   private     application/json; charset=utf-8 iexplore:7564           
7   200 HTTP    api.stackapps.com   /1.0/questions?key=qgAq_KfDu0KYzlNG-qaTuw&pagesize=100&page=7&jsonp=Soapi._internal._callback6  204 private     application/json; charset=utf-8 iexplore:7564