Player Status (API)

From King Arthur's Gold Wiki
Revision as of 13:17, 16 June 2012 by FliesLikeABrick (Talk | contribs)

Jump to: navigation, search

Example call:

https://api.kag2d.com/player/FliesLikeABrick/status

Example output:

{
 "playerStatus": {
   "action": 2, 
   "lastUpdate": "2012-06-15 17:38:29", 
   "server": {
     "serverIPv4Address": "204.152.222.197", 
     "serverIPv6Address": "2607:fcd0:1337:29::2", 
     "serverPort": 50301
   }
 }
}

Note that this may contain additional keys besides playerStatus in the future, and that playerStatus may contain additional keys.

Note that the lastUpdate key will be removed and instead a Last-Modified header will be used shortly - please write code that checks for one or the other if you use this call right now.

Player actions are:
0: logged into client or ("opened game")
1: joined server
2: playing on server
3: left server


You can then make a subsequent call to Server Status (API) to get the server information, since you now have the server addresses and ports. You should dynamically select serverIPv4Address or serverIPv6Address when constructing the call for Server Status (API) since not all servers will have both (and future servers may be IPv6-only!)