LB-1532: Add API endpoints for user data export#3650
Open
pranavsource1 wants to merge 1 commit intometabrainz:masterfrom
Open
LB-1532: Add API endpoints for user data export#3650pranavsource1 wants to merge 1 commit intometabrainz:masterfrom
pranavsource1 wants to merge 1 commit intometabrainz:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
listenbrainz/webserver/views/export_api.pycontaining theExportAPIview class.listenbrainz/webserver/__init__.py.Testing:
listenbrainz/webserver/views/test/test_export_api.py.I have run the code and manually tested the changes
AI usage
If you did use AI:
Action
None