cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We’re having some trouble with our services currently. We’re working to fix the problem as quickly as we can. We’ll share another update shortly. For the latest information visit 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
Go to solution

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
Go to solution

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
Go to solution

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
Go to solution

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
Go to solution

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
Go to solution

Thanks!

Need more support?