Backend API Call to get all games associated with a user? #2217
-
Greetings, I'm creating a backend dashboard for go students with OGS accounts and want to be able to pull a list of their games so I can attach notes + reviews + videos associated with those games, etc. I've perused the resources on https://ogs.docs.apiary.io/#reference/user-specific-resources/ but I can't seem to find a way to get all of the games associated with a particular user. I've gotten as far as calling http://online-go.com/api/v1/players/ to get the "related" "games" response which gives me "/api/v1/players__{playerID}__/games" but don't know what to do with that. Would someone familiar with this kind of thing advise? Thanking you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Sounds like a great project! That is indeed the endpoint, simply do a web request to it and you'll get a JSON blob back. You'll probably want to apply the same filters as we apply in the interface to filter out any uploaded SGFS and whatnot, that looks like: Replacing PLAYERID with whatever user id you want of course. You can view that url in the browser and it'll give you a pretty interface with the JSON dump, when you do a request from a non web browser (your application for instance), it'll come back as just plain JSON so you can parse it easily. |
Beta Was this translation helpful? Give feedback.
-
Also FYI you don't need to follow any related links or anything, those are just informational. Doing a request for the above URL is sufficient, and most reads like you're probably going to do don't need any authentication. |
Beta Was this translation helpful? Give feedback.
Sounds like a great project!
That is indeed the endpoint, simply do a web request to it and you'll get a JSON blob back. You'll probably want to apply the same filters as we apply in the interface to filter out any uploaded SGFS and whatnot, that looks like:
https://online-go.com/api/v1/players/PLAYERID/games/?page_size=10&page=1&source=play&ended__isnull=false&ordering=-ended
Replacing PLAYERID with whatever user id you want of course.
You can view that url in the browser and it'll give you a pretty interface with the JSON dump, when you do a request from a non web browser (your application for instance), it'll come back as just plain JSON so you can parse it easily.