Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to export user content via the REST API #10834

Closed
oplik0 opened this issue Aug 13, 2022 · 1 comment · Fixed by #10858
Closed

Add a way to export user content via the REST API #10834

oplik0 opened this issue Aug 13, 2022 · 1 comment · Fixed by #10858

Comments

@oplik0
Copy link
Contributor

oplik0 commented Aug 13, 2022

Description

The read API contains three export endpoints (/api/user/{userslug}/export/posts, /api/user/{userslug}/export/uploads and /api/user/{userslug}/export/profile) that for anyone actually wanting to get these files programatically will appear not to work.
The reason is that they don't actually try exporting anything, instead only letting one download a pre-existing export, which is done via users rights and consent page, or socket.io (there doesn't appear to be anything in write API related to this functionality).

So it'd be good to either have these endpoints try generating the export if it doesn't exist yet, or have new endpoint(s) for that purpose.

EDIT: this actually worked in the past. It's a regression back from v1.14, caused by this commit 8383992

Community forum reference

https://community.nodebb.org/topic/16615/export-user-s-posts-in-csv

@julianlam
Copy link
Member

julianlam commented Aug 22, 2022

Yeah makes sense. A new set of API routes would be handy.

  • POST routes to generate a new export
  • Restrict generations to one a day unless admin Locks already exist in existing export generation code
  • HEAD to return Last-Modified or HTTP 204 if no export generated
  • GET sends the file, or HTTP 204 if no export generated
  • Deprecate socket.io calls in favour of api v3 calls
  • Breaking In a separate PR, remove the old routes

Likely will follow the existing schema: /api/v3/users/{uid}/export/posts, and so on...

@julianlam julianlam linked a pull request Aug 22, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants