Difference between revisions of "Darkcanuck/RRServer/Query"

From Robowiki
Jump to navigation Jump to search
(here it is)
 
m (forgot "test" query)
Line 54: Line 54:
 
   "rd_glicko2":2.797,"vol_glicko2":2.796,"pairings":"724","count_wins":"691","timestamp":"2009-06-25 19:49:35",
 
   "rd_glicko2":2.797,"vol_glicko2":2.796,"pairings":"724","count_wins":"691","timestamp":"2009-06-25 19:49:35",
 
   "state":"R","name":"darkcanuck.Holden 1.02","created":"2009-06-23 07:05:22"}}
 
   "state":"R","name":"darkcanuck.Holden 1.02","created":"2009-06-23 07:05:22"}}
 +
 +
 +
== <code>query=test</code> ==
 +
 
 +
Testing query that just returns some simple data.  Use for testing your client app before pulling real data.

Revision as of 06:37, 16 August 2009

Ok, the API query interface is now in beta testing. Here are the details.

Basic Access

The basic URL to use is [1]. You will need to pass it several parameters, either as a GET or a POST request. All queries require the following parameters:

  • user - API user name
  • apikey - unique API key assigned to user
  • query - query to execute

The first two are used to control access to the API so that the server doesn't get overloaded with unnecessary requests. Send me an email (darkcanuck81 at GMail) if you want access and I'll hook you up with a user name and API key. Note that this interface limits the number of requests per minute (currently 10) and per hour (currently 60). Please remember to play nice, as heavy usage of the API impacts rumble uploads and folks trying to view the rankings.

The third parameter controls the type of query, described in the following sections.

All output is sent in JSON format. Currently this takes the form of an associative array with the following keys:

  • params - associative array containing parameters key/value pairs received by the server
  • query - query type executed; does not exist on error
  • data - data set returned by the query (normally an associative array, possibly nested); set to null on error
  • error - set to 1 if an error occurred; does not exist if query was successful
  • message - message with details on the query results; most useful for errors

query=rankings

Returns the full rankings data for the specified game type (similar to rankings table view).

Requires:

  • game - game type to query (eg. roborumble, meleerumble, teamrumble, twinduel, etc.)

Optional:

  • order - ordering to use (eg. score_pct, score_survival, rating_glicko2, etc.); score_pct is the default

Sample output:

 {"1":{"bot_id":"1249","battles":"223","score_pct":84.62,"score_dmg":57.072,"score_survival":64.98,
 "rating_classic":2087.518,"rating_glicko":1779.861,"rd_glicko":8.575,"rating_glicko2":1787.828,
 "rd_glicko2":21.07,"vol_glicko2":21.068,"pairings":"17","count_wins":"16","timestamp":"2009-08-15 05:07:55",
 "state":"1","name":"ags.lunartwins.LunarTwins 1.2","created":"2009-08-13 12:45:33"},
 "2":{"bot_id":"1239","battles":"242","score_pct":74.88,"score_dmg":60.257,"score_survival":64.899,
 "rating_classic":1921.199,"rating_glicko":1674.245,"rd_glicko":7.242,"rating_glicko2":1677.517,
 "rd_glicko2":18.413,"vol_glicko2":18.414,"pairings":"17","count_wins":"17","timestamp":"2009-08-15 05:07:46",
 "state":"1","name":"kc.twins.GeminiTeam 2.1","created":"2009-08-13 08:09:52"}}

query=participant

Returns the rankings data for the specified game type and bot.

Requires:

  • game - game type to query (eg. roborumble, meleerumble, teamrumble, twinduel, etc.)
  • name - name of bot to query (can be active or retired)

Sample output:

 {"1":{"bot_id":"1149","battles":"2124","score_pct":77.197,"score_dmg":68.547,"score_survival":87.431,
 "rating_classic":1713.775,"rating_glicko":1752.005,"rd_glicko":0.566,"rating_glicko2":1751.004,
 "rd_glicko2":2.797,"vol_glicko2":2.796,"pairings":"724","count_wins":"691","timestamp":"2009-06-25 19:49:35",
 "state":"R","name":"darkcanuck.Holden 1.02","created":"2009-06-23 07:05:22"}}


query=test

Testing query that just returns some simple data. Use for testing your client app before pulling real data.