The Community is undergoing a major upgrade. Find out more, ask us questions or share your thoughts here.

Forum Discussion

Konstantinos Giotis's avatar
Konstantinos Giotis
Explorer | Level 3
5 years ago

Getting shared link for each file takes a lot of time

Hello everyone!

Im building something associated with dropbox for my thesis. As I am fetching the files with the 'files/list_folder' endpoint, I wanted for each file, to check if it has a "shared link" . For example, in my drive I have 42 files in root folder. Fetching all those files plus for each file fetching if it has a shared link using the 'sharing/list_shared_links' , takes a huge amount of time. It takes ~0.6 seconds for each request so for 42 files that is ~25 seconds! Thats kinda slow but I can recognise that its usual since i make multiple requests.

 

So my question is, if there is something "fancier" and more time consuming that I can do since thats a big problem for me currently.

Thank you.

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

    If you call /2/sharing/list_shared_links without specifying the "path" parameter, it should return a list of all of the shared links for the connected account. You could then check the list of files against that entire list of shared links. That would likely be faster than calling /2/sharing/list_shared_links for each one. (Note that the /2/sharing/list_shared_links interface is paginated though, so be sure to check the returned 'has_more' value and call back again if needed. Check out the 'has_more' field documentation for more information.)

  • I forgot to mention, that I don't mind if I dont get the shared link. I just want to check if the file is "shared" in the first place. But in the files metadata this info doesn't exist from what I found...

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

      If you call /2/sharing/list_shared_links without specifying the "path" parameter, it should return a list of all of the shared links for the connected account. You could then check the list of files against that entire list of shared links. That would likely be faster than calling /2/sharing/list_shared_links for each one. (Note that the /2/sharing/list_shared_links interface is paginated though, so be sure to check the returned 'has_more' value and call back again if needed. Check out the 'has_more' field documentation for more information.)