Skillnad mellan versioner av "TurfAPI V2"

m (tag -> element)
(Formatting of code blocks.)
Rad 23: Rad 23:
 
Example return:
 
Example return:
  
 +
<pre>
 
<?xml version="1.0" encoding="utf-8"?>
 
<?xml version="1.0" encoding="utf-8"?>
<turf><user name="Drassen" id="2" rank="31" pph="7" points="10141" totalpoints="376713" distance="51602.395510" blocktime="30" taken="1846" takenunique="333" region="Blekinge" medals="7,9,13,17,17,28,34" zones="10509,1720,9448,9449,9451,10961" place="587"/>
+
<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.
 
If you provide a username that does not exist, you will get no return except the <turf> element.
Rad 35: Rad 66:
 
Example return:
 
Example return:
  
 +
<pre>
 
<?xml version="1.0" encoding="utf-8"?>
 
<?xml version="1.0" encoding="utf-8"?>
<turf><zone name="EssingeTorget" points_take="170" points_hold="2" lat="59.320361" lng="17.988137"/><zone name="Ulrikzone" points_take="170" points_hold="2" lat="59.317038" lng="18.002661"/><zone name="Trekantzone" points_take="110" points_hold="6" lat="59.311601" lng="18.021929"/>.............
+
<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>
  
  
Rad 44: Rad 81:
 
Example return:
 
Example return:
  
 +
<pre>
 
<?xml version="1.0" encoding="utf-8"?>
 
<?xml version="1.0" encoding="utf-8"?>
<turf><zone name="Plattan" points_take="65" points_hold="9" lat="59.332250" lng="18.064098" userid="Pelle494" region="Stockholm" takeovers="4923" date_created="2010-09-04 16:41:37"/><zone name="SäveLanding" points_take="185" points_hold="1" lat="57.786081" lng="11.872128" userid="laser" region="Västra götaland" takeovers="101" date_created="2011-09-04 18:36:14"/></turf>
+
<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>
 +
</pre>

Versionen från 12 februari 2013 kl. 13.35

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>