lichess-org / api

Lichess API documentation and examples
https://lichess.org/api
GNU Affero General Public License v3.0
435 stars 145 forks source link

Response to Create Challenge API has changed #361

Closed MarkZH closed 2 months ago

MarkZH commented 2 months ago

It seems like the JSON response for the create challenge endpoint has changed and differs from the API documentation. During a recent use, the following was sent (timestamp time zone is PST):

2024-07-20 23:38:30,153 urllib3.connectionpool (connectionpool.py:549) DEBUG https://lichess.org:443 "POST /api/challenge/Demolito_L6 HTTP/1.1" 200 None

and the following response was received:

2024-07-20 23:38:30,153 lib.lichess (lichess.py:372) DEBUG 
{
  'id': 'JrSOUZ5q',
  'url': 'https://lichess.org/JrSOUZ5q',
  'status': 'created',
  'challenger': {
      'id': 'genetic_chess_bot',
      'name': 'Genetic_Chess_Bot',
      'rating': 1837,
      'title': 'BOT',
      'online': True},
  'destUser': {
     'id': 'demolito_l6',
     'name': 'Demolito_L6',
     'rating': 1876,
     'title': 'BOT',
     'flair': 'nature.rhinoceros',
     'online': True},
  'variant': {
    'key': 'standard',
    'name': 'Standard',
    'short': 'Std'},
  'rated': False,
  'speed': 'rapid',
  'timeControl': {
    'type': 'clock',
    'limit': 1200,
    'increment': 2,
    'show': '20+2'},
  'color': 'random',
  'finalColor': 'black', 
  'perf': {
    'icon': '\ue017',
    'name': 'Rapid'},
  'direction': 'out'
}

Notice that there is no outer {challenge: {...}} grouping. The response should be

{
  challenge: {
    'id': 'JrSOUZ5q',
    ... etc. ...
  }
}