Is there a way to sort `me/games` results by expiration?

I’m writing a notifier for myself and using a pretty inefficient method. First I hit /me/games?ended__isnull=true to get a list of my games, then I hit games/{id} for each game to see whose turn it is and when it expires. That’s a lot of requests!

What I would like to know is which game where it is currently my turn will expire next. Is there a special query string I can pass to find out using a single request?

This is a tough one because it relies a bit on some nested details that’s hard or impossible formulate as a query string. I really think I should give players a special endpoint on /me/ that does this kind of thing for you. I’m adding it to my to-do list.

Sure, thanks! Is there a changelog somewhere I can watch to know when you’ve gotten around to it?

Here you go bmc: https://online-go.com/docs/changelog :smile:

You can also access the changelog by scrolling to the bottom of any page on OGS and clicking the “Changelog” link in the lower right.

Here’s one I have on this problem…

Referring to: https://online-go.com/api/v1/me/games/

I want to get the games ended in 2015.

I go to the interpreter…

payload = {‘results[“ended”]__contains’:‘2015’}
requests.get(‘https://online-go.com/api/v1/me/games’, params = payload,
headers = {‘authorization’:‘Bearer {0}’.format(access_token)}).json()
{u’detail’: u’Game has no field named u’results[“ended”]’’}

payload = {‘ended__contains’:‘2015’}
requests.get(‘https://online-go.com/api/v1/me/games’, params = payload,
headers = {‘authorization’:‘Bearer {0}’.format(access_token)}).json()
{u’detail’: u"Game has no field named u’contains’"}

requests.get(‘https://online-go.com/api/v1/me/games/results’, params = payload,
headers = {‘authorization’:‘Bearer {0}’.format(access_token)}).json()
{u’path’: u’/api/v1/me/games/results’, u’arguments’: {u’ended__contains’: u’2015’}, u’error’: u’Invalid API call’}

payload = {‘results_ended__contains’:‘2015’}
requests.get(‘https://online-go.com/api/v1/me/games’, params = payload,
headers = {‘authorization’:‘Bearer {0}’.format(access_token)}).json()
{u’detail’: u"Game has no field named u’results_ended’"}

payload = {‘results.ended__contains’:‘2015’}
requests.get(‘https://online-go.com/api/v1/me/games’, params = payload,
headers = {‘authorization’:‘Bearer {0}’.format(access_token)}).json()
{u’detail’: u"Game has no field named u’results.ended’"}

There is always a way.

So I take a different approach. Just the rules and a rules set that I haven’t played much – Korean.

payload = {‘results.rules__contains’:‘korean’}
requests.get(‘https://online-go.com/api/v1/me/games’, params = payload,
headers = {‘authorization’:‘Bearer {0}’.format(access_token)}).json()
{u’detail’: u"Game has no field named u’results.rules’"}

payload = {‘resultsrules__contains’:‘korean’}
requests.get(‘https://online-go.com/api/v1/me/games’, params = payload,
headers = {‘authorization’:‘Bearer {0}’.format(access_token)}).json()
{u’detail’: u"Game has no field named u’resultsrules’"}

payload = {‘results[rules]__contains’:‘korean’}
requests.get(‘https://online-go.com/api/v1/me/games’, params = payload,
headers = {‘authorization’:‘Bearer {0}’.format(access_token)}).json()
{u’detail’: u"Game has no field named u’results[rules]’"}

So that’s where I am. Still trying to figure out how to reach nested fields with the Python requests module.