Wins/losses in API

I’m working on making something similar to StackExchange’s flair images for OGS, but would like to have the number of wins and losses in it, but it seems this isn’t currently available in the api.

Any chance of getting it added?

I’m leaning towards having a ‘stats’ endpoint on /api/v1/players/n/

currently your best bet is to hit, for example:

https://online-go.com/api/v1/players/4/full

there is a ‘statistics’ key which will give you all sorts of useful information… unfortunately you’ll also get a gorilla back with the request (though the response time should be pretty reasonable as long as your name isn’t @Pempu).

I’ll add a feature issue in our issue tracker to add this to either /stats or just put it on /api/v1/players/n

2 Likes

Ah, didn’t know about /full/, this will probably do just fine! Thanks. ^_^

BTW, any chance of getting an api for looking up the uid by username? It’s fine either way, but it would be more user friendly if I could give my script an username instead of having to copy the uid, I think.

1 Like

So you can query the playerlist by username, for example:

http://online-go.com/api/v1/players/?username=matburt

You can also query most things by username with a double underscore reference, for instance… here’s a search for all games where I play as black that hasn’t ended yet… note the double underscore between ‘white’ and ‘username’ and the is null check with a double underscore between ‘ended’ and ‘isnull’

http://online-go.com/api/v1/games/?black__username=matburt&ended__isnull=true

We’re working on better documenting this as we speak :slight_smile:

3 Likes

Excellent! Thanks.

Hey,

I’m starting to look at all of this again, and noticed that this is still not mentioned anywhere in the API docs by the way.