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

Caligari's avatar
Caligari
Explorer | Level 3
2 years ago

API search access to shared folder

Hey there,

 

I'm working on a small utility using the dropbox API.

 

So far, I've been able to set up an App and used the files/search_v2 endpoint to locate specific files in the scoped app's folder.

 

But my actual use case is to find files in a folder for which the user will have a shared link. The folder is quite large, and I don't want the users to have to add it to their dropbox as a mounted share. Is it possible to pass a shared folder link to an endpoint like search_v2? Or is there another way that I can locate and read the files that I need from a shared folder link without mounting it?

 

Thanks for any advice you can provide.

  • Greg-DB's avatar
    Greg-DB
    2 years ago

    The search endpoints don't support searching within a shared link, but you can use /2/files/list_folder[/continue] to list the contents (and filter client-side as needed) as you mentioned, so I suggest trying that to see if it would be sufficient for your use case.

     

    To do so, you would specify the shared link URL in the 'shared_link.url' field. When doing so, the 'path' field would only be needed if you want to list a relative path for a specific subfolder inside the folder for which you're supplying the shared link.

     

    I suggest trying the API v2 Explorer, as it's helpful for building calls like this.

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

    Hi Caligari,

     

    It sounds like your app has "App folder" access. To access all files and folders a user has access to, including through the search endpoint, your app needs "Full Dropbox" access.

     

    Scott

    • Caligari's avatar
      Caligari
      Explorer | Level 3

      (Wow is it hard to get the API Explorer to generate tokens for a different App, or did I miss something?)

       

      Thanks for that! But...

       

      So, I've created a new Full Access app. But I'm unsure what I'm supposed to put, where, to look for files in the shared folder I have a link for. How do I put that link (or part of it) in the optional Path field?

       

      I note that the list_folder endpoint has a specific shared link field, but not the search endpoint. I suppose I could use the list_folder endpoint and process the list of filenames myself, but there are a lot of them, so I'd rather get just the ones I need, if that is possible.

       

      Advice welcome!

       

      - Caligari

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

        The search endpoints don't support searching within a shared link, but you can use /2/files/list_folder[/continue] to list the contents (and filter client-side as needed) as you mentioned, so I suggest trying that to see if it would be sufficient for your use case.

         

        To do so, you would specify the shared link URL in the 'shared_link.url' field. When doing so, the 'path' field would only be needed if you want to list a relative path for a specific subfolder inside the folder for which you're supplying the shared link.

         

        I suggest trying the API v2 Explorer, as it's helpful for building calls like this.