I’m requesting a list of my running games with
"https://online-go.com/api/v1/me/games/?started__isnull=False&ended__isnull=True", but I can’t find a way to see whose turn it is from the response.
Do I need to get the notification list also to find this out, or is there a single request to get this info with the running games list?
The notifications list is the one that is used for the OGS Notifier Chrome extention.
I haven’t looked at the data returned with the games list to see if it can be parsed to determine who is to move.
You can either look at the notifications endpoint to see if it’s a player’s turn or you can hit the full game view:
and examine the gamedata.clock object where that information is listed.
Thanks for replying. I’m not a web programmer, so I have to get used to these apis. Where can one find these objects? There’s no ‘gamedata’ or ‘clock’ item in the JSON structure.
If you have a list of games, you can check each of them by adding the game number to the above link. Part of the the JSON you will get back is a
clock object with a value
current_player which is the ID of the player to move. You can check that value against the
white properties if you need the color.
What @Traveller said… you will need to visit the full game object at /api/v1/games/n in order to view the clock and gamedata objects for the game. They aren’t presented in listings of games due to the retrieval cost.
OK, thanks - that’s not what I’m looking for to create a list of games. I’ll just use the me/games and me/notifications queries.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.