lishogi icon indicating copy to clipboard operation
lishogi copied to clipboard

API: /api/challenge/open response doesn't match the documentation

Open Pikrass opened this issue 4 months ago • 0 comments

Exact URL where the bug happened

https://lishogi.org/api/challenge/open

Steps to reproduce the bug

Make a request to the endpoint. Mine is a POST request with "Accept: application/json" and the following parameters in the body as a x-www-form-urlencoded:

rated=true
clock.limit=1800
clock.byoyomi=60
clock.increment=0
clock.periods=1
variant=standard

What did you expect to happen?

The documentation specifies an output where "urlSente" and "urlGote" are on the same level as other challenge parameters.

What happened instead?

This is the output I get:

{

	"challenge": {
		"id": "kq0A2SEO",
		"url": "https://lishogi.org/kq0A2SEO",
		"status": "created",
		"challenger": null,
		"destUser": null,
		"variant":  {
			"key": "standard",
			"name": "Standard"
		},
		"rated": false,
		"speed": "classical",
		"timeControl":  {
			"type": "clock",
			"limit": 1800,
			"increment": 0,
			"byoyomi": 60,
			"periods": 1,
			"show": "30|60"
		},
		"color": "random",
		"perf":  {
			"icon": "+",
			"name": "Classical"
		}
	},
	"socketVersion": 0,
	"urlSente":  "https://lishogi.org/kq0A2SEO?color=sente",
	"urlGote": "https://lishogi.org/kq0A2SEO?color=gote"
}

Most of the parameters, except for "urlSente" and "urlGote", are bundled in an "challenge" object.

(As an aside, I notice the "rated" parameter is not taken into account)

Pikrass avatar Sep 27 '24 17:09 Pikrass