Server Error trying to Challenge a player through /api/v1/

Hi, I’m trying to challenge a player through the post API at https://online-go.com/api/v1/players/293685/challenge. I’ve managed to make moves and pause a game through the API, but I’m not able to start a new game through it.

The server always responds just with

Server Error (500)

and no more information, so I’m not sure which piece I’m doing wrong. :confused:

Here’s my code (in python), copied almost exactly from the api docs:

values = '''
  {
    "game": {
        "name": "a test game",
        "rules": "japanese",
        "ranked": false,
        "handicap": 0,
        "time_control_parameters": {
            "time_control": "fischer",
            "initial_time": 259200,
            "max_time": 604800,
            "time_increment": 86400
        },
        "pause_on_weekends": true,
        "width": 9,
        "height": 9,
        "disable_analysis": true
    },
    "challenger_color": "automatic",
    "min_ranking": 0,
    "max_ranking": 0
}
'''
headers = {
  'Content-Type': 'application/json',
  "Authorization" : "Bearer " + token
}
url = 'https://online-go.com/api/v1/players/293685/challenge'
r = requests.post(url, data=values, headers=headers)

if not r.ok:
  print(r, r.text)

I’m logged in as player 293686, and I’m able to make moves on an existing game using the web post API, and able to view my current games, other player info, etc., through the web get API. This is the only API function I wasn’t able to get to work.

Is it currently supported? Am I doing something wrong?
Thanks.

This is still an issue for me. Any luck solving this?

1 Like

Try adding “system” and moving “time_controls”, “speed”, and maybe even “initialized”. I also have the max and min rank set different and I put them before. Placement probably doesn’t matter with these though. I’ve also never tried correspondence speed, but I know it works with live speed.

  {
    "initialized": false
    "min_ranking": -1000,
    "max_ranking": 1000,
    "challenger_color": "automatic",
    "game": {
        "name": "a test game",
        "rules": "japanese",
        "ranked": false,
        "handicap": 0,
        "time_control_parameters": {
            "system": "fisher",
            "speed": "correspondence",
            "initial_time": 259200,
            "max_time": 604800,
            "time_increment": 86400
        },
        "pause_on_weekends": true,
        "time_control": "fischer",
        "width": 9,
        "height": 9,
        "disable_analysis": true
    },
    "aga_ranked":false
}

and if you want automatic handicap, set handicap to -1

2 Likes