cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Tell us what you want to see on the Community here!
Close

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?

Highlighted

How to dowload a shared file by its id?

Explorer | Level 3

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
Highlighted

Re: How to dowload a shared file by its id?

Dropboxer

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
Highlighted

Re: How to dowload a shared file by its id?

Dropboxer

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

Highlighted

Re: How to dowload a shared file by its id?

Explorer | Level 3

Cool, Thanks a lot, Greg.

Have a wonderful day.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?