I tried to do a restore ... that did not seem to work.
Is undelete only available via the Web interface ?
https://www.dropbox.com/developers/core/docs#restore is the right endpoint. When you say it "did not seem to work," what do you mean? What did you try, and what exactly went wrong?
I restored using the latest version ... is the latest version the deleted version ?
It return an error indicating the file did not exist.
Maybe I needed to use the N-1 version.
I was able to restore using the N-1 version. (i.e. the second revision returned from the revisions call)
Might be good to add a comment or example on restore API on how to undelete a file.
Thanks for the suggestion!
I can't believe this bit me again. The first time was with the Android V1 API. Now with the .NET API
The Scenario:
From the WebPage Access I delete a file.
Then from the API I detect the file does not exist (Fails on the GetMetadata request for the path.)
So I check to see if I can restore by calling ListRevisions. It shows file is deleted. I get 3 back FileMetadata entries: (Deleted, MostRecent, Orignal).
If I try yo restore the Delete file it fails ... indicating ivalid revision ... but there is NOTHING in the FileMetaData that indicates the first entry is Deleted ... i.e. should the IsDeleted flag be set ?
I tried to use Files.RestoreAsync using the Revison from all 3 FileMetadata returned from ListRevisions and was not able to restore.
Richard, can you share some sample code/output for the issues you're seeing? Thanks in advance!
Can you also post whatever error or unexpected output you're getting? Thanks!
Inspecting information from the limited feedback in the exception ... It indicates the Revision is bad.
Your code is working fine to restore a file in my testing. Can you share the output you're getting (what you're logging with PersistLog)? That looks like it may contain some useful information for your particular case.
The only thing is the DBPath nothing else useful except the exception.
PersistLog just makes a copy of the error ... otherwise it's just a print statement.
This is in an application context .. So the file is in the top level of my APP folder.
The DBPath is: "/AccountInfo-DO-NOT-DELETE-DO-NO-SHARE"
What about md.Rev? The exception is reporting an invalid revision, so that value may be relevant.
mClient is the DropboxClient opened with my APP Token
Note: the call to ListRevisionsAsync worked!
md.Rev is from the FileMetadata that is in the list of entries returned from ListRevisionsAsync.
I looked at it ... It seemed reasonable ... a string with numbers and a few letters in it ... maybe Base64 or Hex encoded ... I do not remember exactly.
NOTE: I iterated over the list of FileMetadata returned from ListRevisionsAsync (there were 3) .. they ALL generated an exception.
Yes, but can you share the actual rev values? We'll look into why the API isn't accepting them.
The exception had a string of the form: {"invalid_revision/."}
The revisions in the order of failing are:
1512685407b 1452685407b 1442685407b
Thanks! With those, I was able to track down the conditions necessary to reproduce this. We'll work on a fix.
This should be working properly now.
Was this a server side issue ? Or do I need a new version of the API ?
This was a server-side issue, so it should work now with the same version of the SDK. Please give it a try and let us know if you run in to any issues.
I can confirm that it has been fixed ...
Hi everyone,
I was searching for a way to use Dropbox API to restore my files and Google brought me here.
First of all, a bit about my situation:
My computer got a virus that rename all of my files (idk if its recognized as rename or delete on Dropbox) and they are all synced to Dropbox. I want to download all my original files using Dropbox API.
As i can see on web interface, I can download them individually but I got like thousand files so I couldn't do it.
My problem:
I used Python API wrapper to work with Dropbox API. I first fetched all of my files and tried to get all of their revisions but the original files are not included in revision list.
Then I tried to list all of my files including deleted files and I can see my original files listed. I tried to download them using download endpoint but it returned `File not found` error. Has anyone bumped into something similar? How can I solve this issue?
My code snippet:
dbx = dropbox.Dropbox('token is intentionally hidden')print dbx.users_get_current_account()for entry in dbx.files_list_folder('', recursive = False, include_deleted = True).entries: if (isinstance(entry, dropbox.files.FileMetadata) or isinstance(entry, dropbox.files.DeletedMetadata)): if not entry.name.endswith('cerber2'): print "name: ", entry.name, "| path: ", entry.path_lower print repr(entry) meta = dbx.files_restore(entry.path_lower) print repr(meta) try: meta, resp = dbx.files_download(entry.path_lower) except dropbox.exceptions.ApiError as e: print e.user_message_text print "-" * 80
[Cross-linking for reference: https://stackoverflow.com/questions/38912264/restore-deleted-files-using-dropbox-api ]
Hi Sún, it looks like you posted this on StackOverflow too, so I'll help over there, so that we don't spam the other people on this thread.