Open FiretronP75 opened 6 months ago
And to quickly fix my immediate issue, is there some command I can run to restore all archived?
I guess you may look at the api ?
https://www.getoutline.com/developers#tag/Documents/paths/~1documents.restore/post
I guess you may look at the api ?
https://www.getoutline.com/developers#tag/Documents/paths/~1documents.restore/post
The API also makes you restore them one at a time. A loop could be coded, except there is no API for List all archive documents. Search all documents has a status filter for archived. That would work if all the parameters are optional. And it looks like they are because on other API endpoints it says Required under some fields.
OK, so I need to create an API token, then write a script that hits /documents.search with { "statusFilter": "archived" }
then loop over the result and call documents.restore on each one with { "id": "itsID" }
and that should restore everything that is archived.
I see in the code https://github.com/outline/outline/blob/main/server/routes/api/documents/documents.ts that there is of course endpoints for list archived and list deleted because the GUI uses those. Are they accidentally missing from the documentation? Or are they only accessible from the app?
I see that the ones listed in the docs have auth()
while the others have auth({ role: UserRole.Member })
so I'm guessing that makes them only accessible by the app.
on the documents.search I'm getting a validation error 'query: Required' even tho the docs say it is optional. does query take wildcards like * or % ?
This is very unfortunate, I would honestly just restore the database if you have a backup. It would be easier allaround but I'm guessing that's not an option here. To answer your questions:
query
is required on documents.search
but *
might work, this sounds like a mistake in the docs.documents.archived
is the way forward, I would paginate through them all into memory and build the tree struture by looking at parentDocumentId
and then restore going down the tree – if you restore a document where the parent has not yet been restored it will not work correctly.*
does not work for search. I will try documents.archived
Are you sure it is not a bug, that subpages do not restore along with parents? I think it works like that for Trash. And of course in Notion. I guess you might call it a feature, but it is inconsistent to have them archive as a group but not restore as a group.
It's borderline for sure, it was designed like this so not a bug – but probably a bad decision and the behavior should be changed.
I have them all restored now using a script hitting the API.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days
This is still a good enhancement. Let's keep it open.
I accidentally archived a page that has thousands of sub pages. When I restored it, none of the sub pages restored with it. There are too many to do it one by one.
To Reproduce Steps to reproduce the behavior:
Expected behavior Anything that archives together, should restore together.
Outline (please complete the following information):
Desktop (please complete the following information):