Skip to content

LB-1532: Add API endpoints for user data export#3650

Open
pranavsource1 wants to merge 1 commit intometabrainz:masterfrom
pranavsource1:master
Open

LB-1532: Add API endpoints for user data export#3650
pranavsource1 wants to merge 1 commit intometabrainz:masterfrom
pranavsource1:master

Conversation

@pranavsource1
Copy link
Copy Markdown

@pranavsource1 pranavsource1 commented Mar 21, 2026

Problem

Users need a way to export their ListenBrainz data (listens, feedback, etc.) programmatically or via the web interface. Currently, there is no dedicated API to trigger and retrieve these exports asynchronously.

Solution

Implemented a new User Data Export API to handle asynchronous data exports.

  • New API Endpoints (/1/export/):

    • POST /: Triggers a new export task.
    • GET /: Lists historical exports for the authenticated user.
    • GET /<export_id>: Retrieves status and details of a specific export.
    • GET /<export_id>/download: Redirects to the download URL for the exported file.
  • Backend Changes:

    • Added listenbrainz/webserver/views/export_api.py containing the ExportAPI view class.
    • Registered the new blueprint in listenbrainz/webserver/__init__.py.
  • Testing:

    • Added listenbrainz/webserver/views/test/test_export_api.py.
    • Verified functionality with integration tests covering creation, listing, retrieval, and authorization.
  • I have run the code and manually tested the changes

AI usage

  • I did not use any AI
  • I have used AI in this PR

If you did use AI:

  • I used AI tools for communication
  • I used AI tools for coding
  • I understand all the changes made in this PR

Action

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant