You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

user44's avatar
user44
Explorer | Level 4
8 months ago

How to get id of a deleted folder?

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?

  • 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.

  • iNeil's avatar
    iNeil
    Icon for Dropbox Engineer rankDropbox 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's avatar
      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's avatar
        iNeil
        Icon for Dropbox Engineer rankDropbox 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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,888 PostsLatest Activity: 49 minutes ago
326 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!