Conquer Club API
Posted: Thu May 14, 2009 5:44 pm
Conquer club now has a vastly improved API (XML output) , thanks to lack for a lot of hard work:
http://www.conquerclub.com/api.php
This page lists all inputs and outputs but I'll go through a simple description here with an example.
There are four modes - map, maplist, player,and gamelist
mode=map
Gives XML with information about a specific map.
Input Parameters:
Output:
Gives an XML with information on all maps
The output is a subset of the tags for an individual map.
mode=player
Gives XML with information about a specific player.
Input Parameters:
Output:
Returns a single game or a set of games.
Input Parameters (all are optional URL query parameters so you can use any combination of them):
The base URL is http://www.conquerclub.com/api.php?mode=gamelist
So add any number of parameters by adding ¶meter=value
So let's look at a typical output.
Using
Root tag is <api>
Each page contains a maximum of 200 games.
So here since the total games is 244 we already know we need 2 pages.
Now we have a set of games each looking like this:
We can split the info into 3 sections : General Info, Player Info, and Log (Event) Info.
General Info
Player Info
The value of the tag depends on the player format so by default it is user id # but you can have text names using &names=Y
Log (Event) Info
The numbers in these events correspond to the number of the player in the Players array in the <players> tag.
So for example 3 eliminated 2 corresponds to user 154809 eliminating user 152099
Timestamps are standard number of milliseconds since 1970.
Possible Events :
http://www.conquerclub.com/api.php
This page lists all inputs and outputs but I'll go through a simple description here with an example.
There are four modes - map, maplist, player,and gamelist
mode=map
Gives XML with information about a specific map.
Input Parameters:
- map - map name
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=map&mp=Africa - gets the Africa map
Output:
- Code: Select all
<api>
<map>
<title>Africa</title>
<xml>Africa.xml</xml>
<small>Africa.S.jpg</small>
<large>Africa.L.jpg</large>
<thumbnail>Africa.thumb.png</thumbnail>
<topic>674</topic>
<status>N</status>
<small_width>575</small_width>
<small_height>524</small_height>
<large_width>768</large_width>
<large_height>700</large_height>
<territories>45</territories>
</map>
</api>
- <title> - the map title
- <xml> - the xml filename
- <small> - the small graphic filename
- <large> - the large graphic filename
- <thumbnail> - the thumbnail graphic filename
- <topic> - the id of discussion topic url i.e. forum/viewtopic.php?t=#
- <status> - "N" = Normal, "B" = Beta, "C" = Closed, "R" = Random
- <small_width> - the small graphic width
- <small_height> - the small graphic height
- <large_width> - the large graphic width
- <large_height> - the large graphic height
- <territories> - the number of territories
Gives an XML with information on all maps
- Code: Select all
http://www.conquerclub.com/api.php?mode=maplist
The output is a subset of the tags for an individual map.
mode=player
Gives XML with information about a specific player.
Input Parameters:
- u- user id
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=player&u=103452 - gets the user with id 206478
- un- user name
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=player&un=chipv - gets the user chipv
Output:
- Code: Select all
<api>
<player>
<userid>206478</userid>
<username>chipv</username>
<score>2531</score>
<games_completed>549</games_completed>
<games_won>251</games_won>
<rank>Colonel</rank>
<rating>4.9</rating>
<country>United Kingdom</country>
<attendance>100</attendance>
<medals>12</medals>
</player>
</api>
- <userid> - the user id #
- <username> - the username
- <score> - the score
- <games_completed> - the number of games completed
- <games_won> - the number of games won
- <rank> - the rank
- <rating> - the rating
- <country> - the country
- <attendance> - the % attendance
- <medals> - the number of medals
Returns a single game or a set of games.
Input Parameters (all are optional URL query parameters so you can use any combination of them):
The base URL is http://www.conquerclub.com/api.php?mode=gamelist
So add any number of parameters by adding ¶meter=value
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&it=E&po=S>=S&bc=2&ft=C gives all Automatic Sequential Standard Escalating Chained games
- gn - game #
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&gn=103452 - gets game # 103452
- p1 - player 1 user id #
- p2 - player 2 user id #
- p3 - player 3 user id #
- p4 - player 4 user id #
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&p1=103452 - gets all games for player 1 with user id 103452
- p1un - player 1 username
- p2un - player 2 username
- p3un - player 3 username
- p4un - player 4 username
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&p1un=chipv - gets all games for chipv
- np - # of players
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&np=6 - gets all 6 player games
- gt - game type (S)tandard, (C)Terminator, (A)ssassin, (D)oubles, (T)riples, (Q)uadruples or (P)olymorphic
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist>=A - gets all Assassin games
- mp - map name
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&mp=Asia - gets all Asia games
- it - initial troops (E)Automatic or (M)anual
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&it=M - gets all Manual games
- po - player order (S)equential or (F)reestyle
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&po=S>=A - gets all Sequential Assassin games
- bc - spoils (1)No Spoils, (2)Escalating, (3)Flat Rate or (4)Nuclear
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&bc=4&mp=Feudal War - gets all Nuclear Feudal games
- ft - reinforcements (C)hained, (O)Adjacent , (M)Unlimited , (P)arachute or (N)one
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&ft=C&mp=England - gets all Chained England games
- wf - fog of war (Y)es or (N)o
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&wf=Y&mp=Montreal - gets all Fog Montreal games
- gs - game state (W)aiting, (A)ctive or (F)inished
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&un=chipv&gs=F - gets all Finished games for chipv
- to - tournament name
- lb - tournament label
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&to=1,000 miles - gets all games in the tournament "1,000 miles"
- sg - speed game (Y)es or (N)o
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&un=chipv&sg=N gets all non-speed games for chipv
- pt - joinability Private (Y)es, (N)o or T(ournament)
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&un=chipv&pt=Y gets all private games for chipv
- page - page # (output is split into pages so use this for chaining results from several pages)
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&un=chipv&page=2 gets page 2 for chipv
- names - Text (Y)es or User Id (N)o (default)
- Code: Select all
e.g. http://www.conquerclub.com/api.php?mode=gamelist&un=chipv&names=Y gets all games for chipv, using text names for players
- events - Show Log events (Y)es or (N)o (default)
- Code: Select all
http://www.conquerclub.com/api.php?mode=gamelist&un=chipv&gs=F&events=Y gets all finished games for chipv plus log events
So let's look at a typical output.
Using
- Code: Select all
http://www.conquerclub.com/api.php?mode=gamelist&p1un=chipv
Root tag is <api>
- Code: Select all
<api>
<page>1 of 2</page>
<games total="244">
Each page contains a maximum of 200 games.
So here since the total games is 244 we already know we need 2 pages.
Now we have a set of games each looking like this:
- Code: Select all
<game>
<game_number>2326879</game_number>
<tournament></tournament>
<private>N</private>
<speed_game>N</speed_game>
<map>Classic Shapes</map>
<game_type>S</game_type>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>C</fortifications>
<war_fog>N</war_fog>
<round>7</round>
<time_remaining>0</time_remaining>
<players>
<player state="Lost">88215</player>
<player state="Lost">152099</player>
<player state="Won">154809</player>
<player state="Lost">198136</player>
<player state="Lost">206478</player>
<player state="Lost">149268</player>
</players>
<events>
<event timestamp="1210347992">3 eliminated 4 from the game</event>
<event timestamp="1210348135">3 eliminated 1 from the game</event>
<event timestamp="1210348299">3 eliminated 5 from the game</event>
<event timestamp="1210348405">3 eliminated 2 from the game</event>
<event timestamp="1210348451">3 eliminated 6 from the game</event>
<event timestamp="1210348451">3 won the game</event>
<event timestamp="1210348451">1 loses 33 points</event>
<event timestamp="1210348451">2 loses 26 points</event>
<event timestamp="1210348451">4 loses 15 points</event>
<event timestamp="1210348451">5 loses 15 points</event>
<event timestamp="1210348451">6 loses 13 points</event>
<event timestamp="1210348451">3 gains 102 points</event>
</events>
</game>
We can split the info into 3 sections : General Info, Player Info, and Log (Event) Info.
General Info
- Code: Select all
<game_number>2658300</game_number>
<tournament></tournament>
<private>N</private>
<speed_game>N</speed_game>
<map>Classic Shapes</map>
<game_type>A</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>3</bonus_cards>
<fortifications>M</fortifications>
<war_fog>N</war_fog>
<round>5</round>
<time_remaining>0</time_remaining>
- <game_number> Game Number
- <tournament> Tournament name
- <private> N (Public), Y (Private) , T (Tournament)
- <speed_game> N (Casual) , Y (Speed)
- <map> Map Name
- <game_type> S (Standard), C (Terminator), A (Assassin) , D (Doubles) , T (Triples) , Q (Quadruples) , P (Polymorphic)
- <initial_troops> E(Automatic), M(Manual)
- <play_order> S (Sequential) , F (Freestyle)
- <bonus_cards> 2 (Escalating) , 3 (Flat Rate) , 1 (No Spoils), 4(Nuclear)
- <fortifications> C (Chained) , O (Adjaecent) , M (Unlimited) , P (Parachute) , N (None)
- <war_fog> N (No Fog) or Y (Fog)
- <round> Round Number
- <time_remaining> hrs:min:sec until turn expires or 0 if game finished
Player Info
- Code: Select all
<players>
<player state="Lost">88215</player>
<player state="Lost">152099</player>
<player state="Won">154809</player>
<player state="Lost">198136</player>
<player state="Lost">206478</player>
<player state="Lost">149268</player>
</players>
The value of the tag depends on the player format so by default it is user id # but you can have text names using &names=Y
Log (Event) Info
- Code: Select all
<events>
<event timestamp="1210347992">3 eliminated 4 from the game</event>
<event timestamp="1210348135">3 eliminated 1 from the game</event>
<event timestamp="1210348299">3 eliminated 5 from the game</event>
<event timestamp="1210348405">3 eliminated 2 from the game</event>
<event timestamp="1210348451">3 eliminated 6 from the game</event>
<event timestamp="1210348451">3 won the game</event>
<event timestamp="1210348451">1 loses 33 points</event>
<event timestamp="1210348451">2 loses 26 points</event>
<event timestamp="1210348451">4 loses 15 points</event>
<event timestamp="1210348451">5 loses 15 points</event>
<event timestamp="1210348451">6 loses 13 points</event>
<event timestamp="1210348451">3 gains 102 points</event>
</events>
The numbers in these events correspond to the number of the player in the Players array in the <players> tag.
So for example 3 eliminated 2 corresponds to user 154809 eliminating user 152099
Timestamps are standard number of milliseconds since 1970.
Possible Events :
- Code: Select all
<event timestamp="1210348451"># eliminated # from the game</event>
<event timestamp="1210348451"># was kicked out for missing too many turns</event>
<event timestamp="1210348451"># loses # points</event>
<event timestamp="1210348451"># gains # points</event>
<event timestamp="1210348451">#, #, #, # won the game</event>
<event timestamp="1210348451">#, #, # won the game</event>
<event timestamp="1210348451">#, # won the game</event>
<event timestamp="1210348451"># won the game</event>
<event timestamp="1210348451"># surrendered</event>
<event timestamp="1210348451"># was a deadbeat</event>
<event timestamp="1210348451"># held the objective</event>