API for player statistics
+ Reply to Thread
Page 1 of 7 12345 ... LastLast
Results 1 to 10 of 68

Thread: API for player statistics

  1. Top | #1
    Former Staff
    Join Date
    Sep 2009
    Location
    Finland
    Posts
    23
    Threads
    2

    API for player statistics

    Hello all,

    I've put together an early beta version for an API to access players statistics programatically. You can access it with HTTP and it returns simple xml blobs that contain the data. Currently it supports 3 functions but I'll hopefully be adding more in the future.

    NOTE: Please be reasonable when sending requests to the API. The API is running on the same machine as the stats website so excessive traffic to the API will hinder the user experience of everybody playing the game. We don't want to throttle traffic to the API but if we must we will.

    Right now you can view the general network statistics:

    Code:
    http://stats.shatteredhorizon.com/stats/api/networkStatistics.action
    which return this:

    Code:
    <response status="ok"> 
    	<networkstatistics> 
    		<players>34</players> 
    		<servers>2</servers> 
    		<matches>16464</matches> 
    	</networkstatistics> 
    </response>
    Search for players by name:

    Code:
    http://stats.shatteredhorizon.com/stats/api/searchPlayers.action?name=jarnis
    And get something like this:

    Code:
    <response status="ok"> 
    	<players> 
    		<player> 
    			<id>14784</id> 
    			<name>FM_Jarnis</name> 
    		</player> 
    	</players> 
    </response>
    And you can get a summary of a players statistics using their player or steam id:

    Code:
    http://stats.shatteredhorizon.com/stats/api/playerStatistics.action?playerId=14784
    or
    Code:
    http://stats.shatteredhorizon.com/stats/api/playerStatistics.action?steamId=76561197968173935
    Which in turn returns something like this:

    Code:
    <response status="ok"> 
    	<player> 
    		<id>14784</id> 
    		<name>FM_Jarnis</name> 
    		<points>1888</points> 
    		<rank>EVA Specialist</rank> 
    		<kdratio>0.54</kdratio> 
    		<matches>53</matches> 
    		<killspermatch>6.4</killspermatch> 
    		<totalplaytime>40735</totalplaytime> 
    		<deaths>630</deaths> 
    		<suicides>2</suicides> 
    		<kills> 
    			<total>36547</total> 
    			<assist>5964</assist> 
    			<team>171</team> 
    			<headshots>5462</headshots> 
    			<tankshots>2481</tankshots> 
    			<assaultmode>0</assaultmode> 
    			<snipermode>0</snipermode> 
    			<melee>5877</melee> 
    			<defence>6678</defence> 
    			<yinyang>2859</yinyang> 
    			<whileemped>1460</whileemped> 
    			<ghost>2093</ghost> 
    			<ghostbuster>1292</ghostbuster> 
    			<deathfromabove>5826</deathfromabove> 
    			<pistol>10</pistol> 
    			<shotgun>13</shotgun> 
    			<smg>675</smg> 
    			<assault-rifle>28011</assault-rifle> 
    			<machinegun>39</machinegun> 
    			<railgun>1803</railgun> 
    		</kills> 
    		<time> 
    			<boostmode>2166</boostmode> 
    			<airmode>29136</airmode> 
    			<groundmode>9174</groundmode> 
    		</time> 
    		<game> 
    			<flagcaptures>42</flagcaptures> 
    			<wins>18</wins> 
    			<losses>34</losses> 
    			<draws>0</draws> 
    			<skirmishwins>8</skirmishwins> 
    			<assaultwins>3</assaultwins> 
    			<battlewins>7</battlewins> 
    			<isarounds>20</isarounds> 
    			<mmcrounds>38</mmcrounds> 
    		</game> 
    		<achievements> 
    			<achievement> 
    				<name>the_cleaner</name> 
    				<time>2009-11-04 20:25:46.0</time> 
    			</achievement> 
    			<achievement> 
    				<name>the_assistant</name> 
    				<time>2009-11-04 20:25:46.0</time> 
    			</achievement> 
    			<achievement> 
    				<name>gung_ho</name> 
    				<time>2009-11-04 21:28:15.0</time> 
    			</achievement> 
    			<achievement> 
    				<name>rifleman</name> 
    				<time>2009-11-04 21:28:15.0</time> 
    			</achievement> 
    			<achievement> 
    				<name>sniper</name> 
    				<time>2009-11-04 21:28:15.0</time> 
    			</achievement> 
    			<achievement> 
    				<name>ventilate</name> 
    				<time>2009-11-04 23:09:52.0</time> 
    			</achievement> 
    			<achievement> 
    				<name>ten_in_the_tank</name> 
    				<time>2009-11-04 23:29:34.0</time> 
    			</achievement> 
    			<achievement> 
    				<name>up_close_and_personal</name> 
    				<time>2009-11-05 14:49:24.0</time> 
    			</achievement> 
    			<achievement> 
    				<name>snipe_this</name> 
    				<time>2009-11-06 18:28:48.0</time> 
    			</achievement> 
    		</achievements> 
    	</player> 
    </response>
    If you are interested in building a forum sig generator or a fansite please give it a try and let me know in this thread if you have any comments or questions.

    HeikkiV

    UPDATE 1: Added instructions to use steam id instead of your id
    UPDATE 2: New elements in player xml
    UPDATE 3: Added network statistics and fixed achievement typo
    UPDATE 4: Added note about excessive requests
    UPDATE 5: Added new weapons

  2. Top | #2

    Re: API for player statistics

    Finnaly, this HAAAAAAAAAAAAAAAAAAAAAAAAARD task was finished ;P

    €:
    Achievments?
    Last edited by SEKCobra; 11-10-2009 at 03:59 PM.

  3. Top | #3
    YouGamers Staff Unstoppable beta tester
    Arconaut

    Join Date
    Jun 2000
    Location
    Finland
    Posts
    8,172
    Threads
    1032

    Re: API for player statistics

    Warning: If you use the player name stated in the example, you see some horrible epic fail stats that have nothing to do with me.

    Really. I blame devhax by Heikki. [surrender]

  4. Top | #4
    Former Staff
    Join Date
    Sep 2009
    Location
    Finland
    Posts
    23
    Threads
    2

    Re: API for player statistics

    Quote Originally Posted by SEKCobra View Post
    Achievments?
    Coming soon. This is the 0.1 release. I'll add achievements and more stats soon.

  5. Top | #5
    Junior Member
    Join Date
    Oct 2009
    Location
    United States
    Posts
    82
    Threads
    9

    Re: API for player statistics

    This appeals to my interests. I'll play around with it when I've got some free time

  6. Top | #6

    Re: API for player statistics

    Quote Originally Posted by FM_HeikkiV View Post
    Coming soon. This is the 0.1 release. I'll add achievements and more stats soon.
    Why wait

  7. Top | #7
    Senior Member Arconaut
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    324
    Threads
    17

    Re: API for player statistics

    great effort! thx! but one question i have, is there a simple way to get the stats ID via steam ID? it might be usefull since those two the only staticaly IDīs available, and it makes linking player to stats easier when joining up or requireing steam & stats infos at once.

    wasnīt there a way for you to use the 64 cryped steamids instead of your own uniques?
    Last edited by MadMakz; 11-10-2009 at 05:54 PM.

  8. Top | #8

    Re: API for player statistics

    Any chance you can add the kills and death statistics (#kills, #rifle kills, #melee kills etc)? Awesome though

    edit:

    Also maybe allow to search for multiple names using searchPlayers.action, eg. ?name=Blah,Blah2,Blah3 would return 3 x "Players" tags with the matching players for each CSV search term inside?

    Also from a "usefulness" standpoint it would be better to have the 'totalplaytime' value given as seconds rather than a human-readable string, it allows some calculations to be performed without having to convert that string back into a math-suitable format - I know a lot of languages that allow formatting seconds into a human readable time string with default functions, but the other way around with an arbitrary format is much rarer afaik.

    Just something random because the official stats site has no good way to compare arbitrary players (as well as playing about with the API): http://01100011011011110110001101101...2,Minas,Wisher

    Calculating the kills / deaths from #matches, kills per match and k:d ratio since they're not exported by the stats
    Last edited by MaZ-; 11-11-2009 at 06:25 AM.

  9. Top | #9

    Re: API for player statistics

    Where is the post? o.O
    It says new post by someone, but nothing here o.o

  10. Top | #10
    Former Staff
    Join Date
    Sep 2009
    Location
    Finland
    Posts
    23
    Threads
    2

    Re: API for player statistics

    Quote Originally Posted by MadMakz View Post
    great effort! thx! but one question i have, is there a simple way to get the stats ID via steam ID? it might be usefull since those two the only staticaly IDīs available, and it makes linking player to stats easier when joining up or requireing steam & stats infos at once.

    wasnīt there a way for you to use the 64 cryped steamids instead of your own uniques?
    Yes, you can use a steam id instead of our player id. Eg.

    Code:
    http://stats.shatteredhorizon.com/stats/api/playerStatistics.action?steamId=76561197967188786

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts