lichess-org / api

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

API for Studies #157

Open jynfairchild opened 2 years ago

jynfairchild commented 2 years ago

I would like an API that,

I've built a system that pulls all games for a particular player (OTB games) from tournament sites and consolidates them into a single PGN. I then want a way of creating a study, uploading the PGN, and auto run the engine against each game (chapter), returning a link to that study.

Thank you!

stevecheckoway commented 1 year ago

A full REST API for studies would be nice.

My desired use is

  1. download a random assortment of interactive lesson chapters from my private studies;
  2. create a new (or replace an existing) study; and
  3. add the chapters to the study.
mratanusarkar commented 1 year ago

I have the same requirement. I would like to have an API where I can upload multiple games, positions, studies, and puzzles to Lichess. And most importantly, a way to classify and organize all the uploads into one study, chapter-wise in a logical manner via API, instead of doing it manually, which is so tedious and time-consuming.

for example, the below code uploads a PGN to Lichess, but it only returns a single link to the upload.

# pgn_text = imported pgn file
headers = {
    "Content-Type": "application/x-www-form-urlencoded",
    "Authorization": "Bearer " + YOUR_API_KEY
}
body = {
    "pgn": pgn_text
}
response = requests.post(LICHESS_API_URL, headers=headers, data=body)

If only there was a way to collect all these links and pass it through another API to get them organized into a Study, chapter-wise, or do a bulk upload of all the PGNs together and pass in a JSON that would structure the uploads and organize them into a study.

sertaco commented 8 months ago

Hi all,

Have you had a solution to this issue?

Right now Lichess has an import PGN api into an existing study: https://lichess.org/api#tag/Studies/operation/apiStudyImportPGN

I would like to be able to create a new study at least. Is this possible?

jlkhermes38 commented 6 months ago

Hi all, thanks for the work you have been doing. I agree with comments in this thread, it would be great to enrich this API also allowing to import FEN as a new chapter, modify the parameters of the chapter and allowing to change the metadata.

Thanks

mratanusarkar commented 6 months ago

long ago, I recall creating a detailed issue on the same, with some ideas on what the API could be like. I will link it here so that everyone can take a look. Issue: #224

If I get some time in the future, I will try to implement the same and raise a PR. In the meantime, if anyone is interested, feel free to go ahead and start... and I might join in.