I have read in the API that it is possible to challange another user by going to the url:
https://lichess.org/api/challenge/{username}
From the API it looks like that it is possible to include the color and time too.
Is it possible to include these parameters in the url?
Could somebody help me with an example of a link where I challenge another user with white, initial time of 50 min and 10sec/move increment?
Reason for this is that we would like to create a club competition where we provide the pairings. We would like to provide links for the white players to make it easier.
Even nicer would be if black accepts automatically, or if I could pair the players together. Did I understand it correctly that that would be possible if I include OAuth2? Could somebody guide me in the direction on how to do this?
I have read in the API that it is possible to challange another user by going to the url:
https://lichess.org/api/challenge/{username}
From the API it looks like that it is possible to include the color and time too.
Is it possible to include these parameters in the url?
Could somebody help me with an example of a link where I challenge another user with white, initial time of 50 min and 10sec/move increment?
Reason for this is that we would like to create a club competition where we provide the pairings. We would like to provide links for the white players to make it easier.
Even nicer would be if black accepts automatically, or if I could pair the players together. Did I understand it correctly that that would be possible if I include OAuth2? Could somebody guide me in the direction on how to do this?
Is it possible to include these parameters in the url?
No, since the parameters have to be in the body of a HTTP POST request, in application/x-www-form-urlencoded format.
Even nicer would be if black accepts automatically, or if I could pair the players together. Did I understand it correctly that that would be possible if I include OAuth2?
Yep: https://lichess.org/api#operation/challengeAccept
Let the opponent authenticate through OAuth and then you can POST a request to that endpoint with the access token you got from that.
> Is it possible to include these parameters in the url?
No, since the parameters have to be in the body of a HTTP POST request, in application/x-www-form-urlencoded format.
> Even nicer would be if black accepts automatically, or if I could pair the players together. Did I understand it correctly that that would be possible if I include OAuth2?
Yep: https://lichess.org/api#operation/challengeAccept
Let the opponent authenticate through OAuth and then you can POST a request to that endpoint with the access token you got from that.
In PHP using Guzzle:
$response = $this->client->request('POST', '/api/challenge/' . $username, [
'headers' => $this->headers, // This includes Authorization Bearer...
'form_params' => [
'clock.limit' => 3 * 60,
'clock.increment' => 1,
'rated' => "false",
'color' => "random"
]
]);
In PHP using Guzzle:
$response = $this->client->request('POST', '/api/challenge/' . $username, [
'headers' => $this->headers, // This includes Authorization Bearer...
'form_params' => [
'clock.limit' => 3 * 60,
'clock.increment' => 1,
'rated' => "false",
'color' => "random"
]
]);
Greetings @RawiW!
In comment #3, @kosciuk provides the parameters. kosciuk and I did the test and it works quite well; but it must be done by POST, not by url.
https://lichess.org/api#operation/challengeCreate
Greetings @RawiW!
In comment #3, @kosciuk provides the parameters. kosciuk and I did the test and it works quite well; but it must be done by POST, not by url.
https://lichess.org/api#operation/challengeCreate