Skip to content

API: Add endpoint to update/replace the move tree of a study chapter #20077

@ImMoSer

Description

@ImMoSer

Description:
Following a discussion with thibault on Discord, I am requesting an API endpoint to update or replace the entire move tree (PGN) of an existing study chapter.

Current Problem:
Currently, there is no direct way to update the moves of a chapter via API. The POST /api/study/{studyId}/{chapterId}/tags endpoint specifically ignores moves. To update a chapter's content, developers must:

  1. DELETE the existing chapter.
  2. POST (import) a new PGN to create a new chapter.

Why this is suboptimal:

  • It changes the chapterId, which breaks external references or local cache states.
  • It is an expensive "delete-and-recreate" operation for what should be a simple update.
  • For synchronization tools, maintaining the same chapter structure is crucial for a smooth UX.

Proposed Solution:
An endpoint like PATCH /api/study/{studyId}/{chapterId} or a specialized POST endpoint that accepts a PGN string and replaces the existing move tree while keeping the chapterId and metadata intact.

Use Case:
I am building a synchronization tool (Chessboard.fun) that allows users to keep their local study progress in sync with Lichess. Efficiently updating moves without recreating chapters is essential for this workflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions