cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results forĀ 
ShowĀ Ā onlyĀ  | Search instead forĀ 
Did you mean:Ā 

Re: How to get id of a deleted folder?

How to get id of a deleted folder?

user44
Explorer | Level 4

While building an integration with Dropbox I am running into typical situation of deleting folders at my app's end when a subject folder is deleted by the user on Dropbox. Via webhooks I am getting Metadata object actually DeleteMetadata object which does have path but no id, at my end we don't keep track of paths as such we were expecting the id within DeleteMetadata so as we can take action accordingly at our end.

 

Any recommendations?

1 Accepted Solution

Accepted Solutions

iNeil
Dropbox Engineer

Hello @user44

You are correct that the /2/files/list_revisions endpoint will only work for files.

 

There isnā€™t a way to retrieve the deleted folder's id with the Dropbox API. If you have the previous FolderMetadata, you can align it based on the path from the DeletedMetadata.

View solution in original post

4 Replies 4

iNeil
Dropbox Engineer

Unfortunately, the Dropbox API doesn't return the file/folder ID for the DeletedMetadata, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

To retrieve the history of a deleted file, you can call the /2/files/list_revisions endpoint with the path from the DeletedMetadata. This will provide the file ID(s). Alternatively, you can store the path and ID for each last (File|Folder)Metadata you retrieved so that when you get a DeletedMetadata, you can check what the last known file ID was for that path.

user44
Explorer | Level 4

Thanks for replying, the call /2/files/list_revisions is only for files I guess, and not for the folders.

I am using Dropbox's Java SDK and I am getting this erxception thrown while reaching it with a path to a folder instead of file : com.dropbox.core.v2.files.ListRevisionsErrorException: Exception in 2/files/list_revisions: {".tag":"path","path":"not_file"}  

So, looks like the bottom line is, there is no way to get deleted folder's id, and we have to align the webhook notification with our system with path only.

iNeil
Dropbox Engineer

Hello @user44

You are correct that the /2/files/list_revisions endpoint will only work for files.

 

There isnā€™t a way to retrieve the deleted folder's id with the Dropbox API. If you have the previous FolderMetadata, you can align it based on the path from the DeletedMetadata.

user44
Explorer | Level 4

Thanks!

Need more support?