Difference between revisions of "Turf API V2"

(Created page with "== Usage == http://api.turfgame.com/v2 Will take you to a page asking you to be more specific. '''RSS''' http://api.turfgame.com/v2/rss Fetches an RSS-feed containing the 10...")
 
m (r2.7.3) (Robot: Adding sv:TurfAPI V2)
Line 105: Line 105:
 
</pre>
 
</pre>
 
[[Category:Third-Party Development]]
 
[[Category:Third-Party Development]]
 +
 +
[[sv:TurfAPI V2]]

Revision as of 21:37, 11 March 2013

Usage

http://api.turfgame.com/v2 Will take you to a page asking you to be more specific.

RSS

http://api.turfgame.com/v2/rss Fetches an RSS-feed containing the 10 latest takeovers in the game.

http://api.turfgame.com/v2/rss/stockholm/göteborg/skåne Adding regions to the url will make the rss only show takeovers from those regions.

http://api.turfgame.com/v2/rss/stockholm/?antal=45 the GET-variable "antal" lets you choose the number of takeovers to be returned. maximum 100.

User

http://api.turfgame.com/v2/user/tomtebloss/drassen Lets you fetch information about selected users.

You may also use id:xx instead of the username.

Example return:

<?xml version="1.0" encoding="utf-8"?>
<turf>
  <user id="2" 
        name="Drassen"
        blocktime="30"
        distance="51754.204360"
        medals="7,9,13,17,17,28,34"
        place="471"
        points="4889"
        pph="27"
        rank="31"
        region="Blekinge"
        taken="1875"
        takenunique="335"
        totalpoints="387679"
        zones="1377,3182,8798,9310,9353,9409,12457" />
  <user id="350"
        name="tomtebloss"
        blocktime="30"
        distance="40682.514488"
        medals="1,1,1,2,2,3,4,5,7,9,15,16,21,24,27,28,38,47"
        place="144"
        points="21642"
        pph="31"
        rank="47"
        region="Stockholm"
        taken="11951"
        takenunique="1161"
        totalpoints="3896847"
        zones="159,276,1098,7476,7477,7478,7479,7667,7831" />
</turf>

If you provide a username that does not exist, you will get no return except the <turf> element.

Zones

http://api.turfgame.com/v2/zones Will return all zones from the game, including pivot points. This action is demanding and is therefore subject to longer caching intervals(2 hours).

Example return:

<?xml version="1.0" encoding="utf-8"?>
<turf>
  <zone lat="59.320361" lng="17.988137" points_hold="2" points_take="170" name="EssingeTorget" />
  <zone lat="59.317038" lng="18.002661" points_hold="2" points_take="170" name="Ulrikzone" />
  <zone lat="59.311601" lng="18.021929" points_hold="6" points_take="110" name="Trekantzone" />
  ...


http://api.turfgame.com/v2/zones/plattan/id:3002/ Will return only selected zones, but with more information than the example above. You may use either the id or the name of the zone.

Example return:

<?xml version="1.0" encoding="utf-8"?>
<turf>
  <zone name="Plattan" 
        date_created="2010-09-04 16:41:37" 
        lat="59.332250" 
        lng="18.064098" 
        points_hold="9" 
        points_take="65" 
        region="Stockholm" 
        takeovers="4923" 
        userid="Pelle494"/>
  <zone name="SäveLanding" 
        date_created="2011-09-04 18:36:14" 
        lat="57.786081" 
        lng="11.872128" 
        points_hold="1" 
        points_take="185" 
        region="Västra götaland" 
        takeovers="101" 
        userid="laser"/>
</turf>