cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

How to dowload a shared file by its id?

How to dowload a shared file by its id?

Pearman
Explorer | Level 3
Go to solution

I'm trying to make a simple web app that will list contents on one particular shared folder. There is about 200 small excel files in that folder and the app would like to download those files and do some magic on them.

 

I was able to list all files with: 

dbx.filesListFolder({
  path: "/some path",
  include_media_info: true,
  shared_link: {
    url: "https://www.dropbox.com/sh/id_or_whatever/another_random_string?dl=0"
  }
})

 

Now I would like to download all the files and do something with them.
I tried `filesDownloadZip` but it rejected path in form of "id:asdfasdf" where asdfasddf is a string I got from parent_shared_folder_id  

`filesDownload` throws the same error. Other posts on this forum mentioned `sharingGetSharedLinkFile` but that requires some kind of preview link.

 

Thanks in advance.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

You can use filesDownloadZip (for an entire folder) or filesDownload (for a specific file) if the file/folder is in the account that you're connected to (i.e., for the access token you're using). In that case, the 'id' should just be the 'id' property returned in the relevant FilesFileMetadata or FilesFolderMetadata object you got from filesListFolder. You should not try to construct that value yourself. (The 'parent_shared_folder_id' is a different kind of ID.) Likewise, if the folder is in the connected account, you can list the contents using filesListFolder/filesListFolderContinue without passing in the shared link, by instead just using the relevant path in the account.

 

If the content is not in the connected account though, you will need to instead use sharingGetSharedLinkFile instead, like you mentioned. You do need to pass in the 'url' and 'path' in that case, but the 'url' in that case is the same "https://www.dropbox.com/sh/..." you used originally.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

You can use filesDownloadZip (for an entire folder) or filesDownload (for a specific file) if the file/folder is in the account that you're connected to (i.e., for the access token you're using). In that case, the 'id' should just be the 'id' property returned in the relevant FilesFileMetadata or FilesFolderMetadata object you got from filesListFolder. You should not try to construct that value yourself. (The 'parent_shared_folder_id' is a different kind of ID.) Likewise, if the folder is in the connected account, you can list the contents using filesListFolder/filesListFolderContinue without passing in the shared link, by instead just using the relevant path in the account.

 

If the content is not in the connected account though, you will need to instead use sharingGetSharedLinkFile instead, like you mentioned. You do need to pass in the 'url' and 'path' in that case, but the 'url' in that case is the same "https://www.dropbox.com/sh/..." you used originally.

Pearman
Explorer | Level 3
Go to solution

Cool, Thanks a lot, Greg.

Have a wonderful day.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Pearman Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?