lichess-org / api

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

Add Filter for Standard Starting Position in User Game Export API #266

Open jassler opened 11 months ago

jassler commented 11 months ago

The User Game Export API (https://lichess.org/api/games/user/{username}) currently lacks an option to filter games based on the starting position. It would be helpful to have a query parameter to distinguish between games that start from the standard chess position and games with custom starting positions.

Current Behavior

There is no way to differentiate games that start from a standard position and those which start from a custom position.

Expected Behavior

A new query parameter, such as startingPosition or fromPosition, can be used to filter games starting from the standard position.

Alternatively, include a way to filter starting positions in perfType, which currently allows us to filter for chess variants such as "chess960", "crazyhouse", etc. The variant already displays [Variant "From Position"]. This would make it a little more consistent.

Proposed API call

https://lichess.org/api/games/user/{username}?perfType="blitz,fromPosition"

Returns all blitz games that did not start in the standard position.

Use Case

I often give my students positions as exercises from which they have to win or draw the computer. I’d like to be able to filter and find those games more easily.

Vice versa, it’d probably also be useful to reliably receiving games from normal starting positions without having to manually filter out those that are not.

Thank you for considering this request.