Polymorphic Games Broke the API

Have suggestion for a new or old tool/enhancement? Come on in!

Moderator: Tech Team

Forum rules
Please read the Community Guidelines before posting.
Post Reply
User avatar
runewake2
Posts: 95
Joined: Sun May 23, 2010 1:50 pm
Gender: Male
Location: Betwixt Two Curly Braces
Contact:

Polymorphic Games Broke the API

Post by runewake2 »

It seems that the players field of a polymorphic game is left null when you query the API. This is completely breaking my apps and I'm sure others as well.

Here's the weird thing though, it's not always broken. If I query the game by the username the <players> field is null, however if I do the request by passing in the Game Number I get the correct result. It's all really weird.

Request: http://www.conquerclub.com/api.php?mode ... n=13438668
Result:

Code: Select all

<api>
<page>1 of 1</page>
<games total="1">
<game>
<game_number>13438668</game_number>
<game_state>A</game_state>
<tournament/>
<private>N</private>
<speed_game>N</speed_game>
<map>Vertex</map>
<game_type>P</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>P</fortifications>
<war_fog>Y</war_fog>
<trench_warfare>N</trench_warfare>
<round_limit>0</round_limit>
<round>4</round>
<time_remaining>22:56:28</time_remaining>
<chat>102889063</chat>
<players>
<player state="Waiting">koontz1973</player>
<player state="Waiting">koontz1973</player>
<player state="Waiting">koontz1973</player>
<player state="Waiting">Leehar</player>
<player state="Ready">Leehar</player>
<player state="Waiting">Leehar</player>
</players>
<events/>
</game>
</games>
</api>


Request: http://www.conquerclub.com/api.php?mode ... n=13438668 and http://www.conquerclub.com/api.php?mode ... eehar&gs=a
Result: (Why does this return 3 results including two bad ones?)

Code: Select all

<api>
<page>1 of 1</page>
<games total="3">
<game>
<game_number>13438668</game_number>
<game_state>A</game_state>
<tournament/>
<private>N</private>
<speed_game>N</speed_game>
<map>Vertex</map>
<game_type>P</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>P</fortifications>
<war_fog>Y</war_fog>
<trench_warfare>N</trench_warfare>
<round_limit>0</round_limit>
<round>4</round>
<time_remaining>23:00:56</time_remaining>
<chat/>
<players></players>
<events/>
</game>
<game>
<game_number>13438668</game_number>
<game_state>A</game_state>
<tournament/>
<private>N</private>
<speed_game>N</speed_game>
<map>Vertex</map>
<game_type>P</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>P</fortifications>
<war_fog>Y</war_fog>
<trench_warfare>N</trench_warfare>
<round_limit>0</round_limit>
<round>4</round>
<time_remaining>23:00:56</time_remaining>
<chat/>
<players></players>
<events/>
</game>
<game>
<game_number>13438668</game_number>
<game_state>A</game_state>
<tournament/>
<private>N</private>
<speed_game>N</speed_game>
<map>Vertex</map>
<game_type>P</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>P</fortifications>
<war_fog>Y</war_fog>
<trench_warfare>N</trench_warfare>
<round_limit>0</round_limit>
<round>4</round>
<time_remaining>23:00:56</time_remaining>
<chat>102889063</chat>
<players>
<player state="Waiting">koontz1973</player>
<player state="Waiting">koontz1973</player>
<player state="Waiting">koontz1973</player>
<player state="Waiting">Leehar</player>
<player state="Ready">Leehar</player>
<player state="Waiting">Leehar</player>
</players>
<events/>
</game>
</games>
</api>


Is there an ETA on a fix for this? My app won't run for anyone in a polymorphic game until this is fixed or I write some code to work around it.
Conquer Club Mobile Apps: Conqueror for Windows Phone and Windows 8
Conqueror's going Open Source: Conqueror on CodePlex
User avatar
bigWham
Webmaster
Webmaster
Posts: 2921
Joined: Mon Aug 26, 2013 12:08 pm

Re: Polymorphic Games Broke the API

Post by bigWham »

runewake2 wrote:It seems that the players field of a polymorphic game is left null when you query the API. This is completely breaking my apps and I'm sure others as well.

Here's the weird thing though, it's not always broken. If I query the game by the username the <players> field is null, however if I do the request by passing in the Game Number I get the correct result. It's all really weird.

Request: http://www.conquerclub.com/api.php?mode ... n=13438668
Result:

Code: Select all

<api>
<page>1 of 1</page>
<games total="1">
<game>
<game_number>13438668</game_number>
<game_state>A</game_state>
<tournament/>
<private>N</private>
<speed_game>N</speed_game>
<map>Vertex</map>
<game_type>P</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>P</fortifications>
<war_fog>Y</war_fog>
<trench_warfare>N</trench_warfare>
<round_limit>0</round_limit>
<round>4</round>
<time_remaining>22:56:28</time_remaining>
<chat>102889063</chat>
<players>
<player state="Waiting">koontz1973</player>
<player state="Waiting">koontz1973</player>
<player state="Waiting">koontz1973</player>
<player state="Waiting">Leehar</player>
<player state="Ready">Leehar</player>
<player state="Waiting">Leehar</player>
</players>
<events/>
</game>
</games>
</api>


Request: http://www.conquerclub.com/api.php?mode ... n=13438668 and http://www.conquerclub.com/api.php?mode ... eehar&gs=a
Result: (Why does this return 3 results including two bad ones?)

Code: Select all

<api>
<page>1 of 1</page>
<games total="3">
<game>
<game_number>13438668</game_number>
<game_state>A</game_state>
<tournament/>
<private>N</private>
<speed_game>N</speed_game>
<map>Vertex</map>
<game_type>P</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>P</fortifications>
<war_fog>Y</war_fog>
<trench_warfare>N</trench_warfare>
<round_limit>0</round_limit>
<round>4</round>
<time_remaining>23:00:56</time_remaining>
<chat/>
<players></players>
<events/>
</game>
<game>
<game_number>13438668</game_number>
<game_state>A</game_state>
<tournament/>
<private>N</private>
<speed_game>N</speed_game>
<map>Vertex</map>
<game_type>P</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>P</fortifications>
<war_fog>Y</war_fog>
<trench_warfare>N</trench_warfare>
<round_limit>0</round_limit>
<round>4</round>
<time_remaining>23:00:56</time_remaining>
<chat/>
<players></players>
<events/>
</game>
<game>
<game_number>13438668</game_number>
<game_state>A</game_state>
<tournament/>
<private>N</private>
<speed_game>N</speed_game>
<map>Vertex</map>
<game_type>P</game_type>
<initial_troops>E</initial_troops>
<play_order>S</play_order>
<bonus_cards>2</bonus_cards>
<fortifications>P</fortifications>
<war_fog>Y</war_fog>
<trench_warfare>N</trench_warfare>
<round_limit>0</round_limit>
<round>4</round>
<time_remaining>23:00:56</time_remaining>
<chat>102889063</chat>
<players>
<player state="Waiting">koontz1973</player>
<player state="Waiting">koontz1973</player>
<player state="Waiting">koontz1973</player>
<player state="Waiting">Leehar</player>
<player state="Ready">Leehar</player>
<player state="Waiting">Leehar</player>
</players>
<events/>
</game>
</games>
</api>


Is there an ETA on a fix for this? My app won't run for anyone in a polymorphic game until this is fixed or I write some code to work around it.


ETA=NOW!

seriously though, i doubt this is completely right immediately given that i first saw the API code 15 minutes ago, however it does seem to work on your test cases. also, i added a searchable field for poly_slots.
User avatar
runewake2
Posts: 95
Joined: Sun May 23, 2010 1:50 pm
Gender: Male
Location: Betwixt Two Curly Braces
Contact:

Re: Polymorphic Games Broke the API

Post by runewake2 »

Happy Face. Now there aren't any more games with no players in them. :D
I'm going to do some more testing on this tomorrow, it's rather late right now. Seems to work and any errors should be on me now.

Thanks a ton!

Edit: sleep is for noobs. Did more testing. Everything seems ship shape on your end. Polymorphic games now return correctly and there were no null players containers. Ran the test on 100 random users (from the subset of the players in polymorphic games) so I call it good enough.
Conquer Club Mobile Apps: Conqueror for Windows Phone and Windows 8
Conqueror's going Open Source: Conqueror on CodePlex
Post Reply

Return to “Tools Suggestions”