Changes

Turf API V3

3,385 bytes added, 19:39, 1 March 2013
Created page with "== Usage == http://api.turfgame.com/v3 Will take you to a page asking you to be more specific. '''RSS''' http://api.turfgame.com/v3/rss Fetches an RSS-feed containing the 10..."
== Usage ==
http://api.turfgame.com/v3
Will take you to a page asking you to be more specific.

'''RSS'''

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

http://api.turfgame.com/v3/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/v3/rss/stockholm/?count=45
the GET-variable "antal" lets you choose the number of takeovers to be returned. maximum 100.

'''User'''

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

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

Example return:

<pre>
<?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>
</pre>

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

'''Zones'''

http://api.turfgame.com/v3/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:

<pre>
<?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" />
...
</pre>


http://api.turfgame.com/v3/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:

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

'''Stats'''

http://api.turfgame.com/v3/stats
Will return a set of updated stats from the game.
Example return:

<pre>
<?xml version="1.0" encoding="utf-8"?>
<turf zonestakentoday="3737" zonestakenyesterday="5458" zonestaken="2234384" usersthisround="1686" users="35690"/>
</pre>
[[Category:Third-Party Development]]
141
edits