Forum Discussion

gilbertwulff's avatar
gilbertwulff
Explorer | Level 3
8 years ago
Solved

So what is the use of a folder id?

I've been looking at ways to determine if a folder still exist on a dropbox account. I've noticed that there is two different ids being returned. One being just "id" and the other being "sharedFolderId". I cant find an api where id is being used at the moment or can you point me to a api that is using it?

 

I'm trying to figure out the most effiecient way to grab a folder's info rather than just using path (alpha/get_metadata/{path})(user might have moved the folder path), therefore we were thinking of using the "id" returned and use it to look for the folder. Is there an api i can use to get a folder's metadata by using its id?

  • The 'id' can be used with various endpoints, in place of the file path. In many cases, you can just pass in the 'id' string in the 'path' parameter. For example, you can pass the 'id' as the 'path' value when calling /2/files/get_metadata. That's an easy way to check if a file or folder exists.

     

    The /2/sharing/get_folder_metadata endpoint only operates on shared folders though, so it does require a shared folder ID, not just an 'id'.

     

    You can get the shared folder ID directly from the FolderMetadata object though, e.g., as returned by /2/files/get_metadata or /2/files/list_folder[/continue]. That's included as sharing_info.shared_folder_id in the FolderMetadata object.

  • gilbertwulff's avatar
    gilbertwulff
    Explorer | Level 3

    Extra note:

     

    It would be an api like sharing/get_folder_metadata/{sharing folder id} but in my case i would need to use the "id" instea of "sharingfolderid" because "sharingfolderid" is not returned in the files/list_folder api

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The 'id' can be used with various endpoints, in place of the file path. In many cases, you can just pass in the 'id' string in the 'path' parameter. For example, you can pass the 'id' as the 'path' value when calling /2/files/get_metadata. That's an easy way to check if a file or folder exists.

     

    The /2/sharing/get_folder_metadata endpoint only operates on shared folders though, so it does require a shared folder ID, not just an 'id'.

     

    You can get the shared folder ID directly from the FolderMetadata object though, e.g., as returned by /2/files/get_metadata or /2/files/list_folder[/continue]. That's included as sharing_info.shared_folder_id in the FolderMetadata object.

    • UserAccount's avatar
      UserAccount
      New member | Level 2

      I have just tried as you stated, pass the id in the path param. But unfortunately the request fails, with a message that the path has not been found?

       

      Is this changed now and no longer supported?
      Response sample:

      {"error_summary": "path/not_found/...", "error": {".tag": "path", "path": {".tag": "not_found"}}}

       

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        Hi UserAccount,

        Are you sure you have tried with real folder id (as received from corresponding API call) and not some malformed path? 🤔