cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in learning how media industry leaders use Dropbox Replay? Register for our webinar 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: 

Re: Problem with download a folder as a zip with API

Problem with download a folder as a zip with API

duynh7401
Explorer | Level 4
Go to solution

I try to use this API a lot of time, but it always download a document file which I even could not open. It will be better more if you teach me how to implement this API by using Java JDK. 

The upload api is the same case with download, when I upload any file, it will upload a document file which I could not open.

Thank you all.

Link download zip file API: https://dropbox.github.io/dropbox-api-v2-explorer/#files_download_zip

Screen Shot 2022-03-31 at 02.08.07.png

 

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

Hi @duynh7401,

😯 Seems I was not clear enough.


Hi @Здравко wrote:

... you should fill the path field in Dropbox API Explorer with "/folderName" (without quotes). ... Add ".zip" to the downloaded file name (i.e. "folderName.zip") to make sure your file explorer can "understand" the file correctly. ...



@duynh7401 wrote:

Hi @Здравко 

... As your information, I have add .zip after the folder name (as picture) but it's still not working.

...

Screen Shot 2022-03-31 at 11.53.58.png


I haven't mentioned adding ".zip" in path field!!! Do you have a folder in your account with name "Q4.zip"?! 🧐... Of course, that's why result is "path/not found/". 😉 Path field is for the folder path, not to the downloaded file name! That's why your first call succeeds:


@duynh7401 wrote:

...

Screen Shot 2022-03-31 at 11.53.49.png

...


After this call, result gets backup in your browser; you can push "Download Q4" to get it as a file. In this particular case your browser will propose file name "Q4"; here you can add ".zip" and rename it to "Q4.zip" - at this moment (or later), not in advance! The situation is similar when you use your SDK. The data stream is just a file content, again; this stream doesn't contain file name - managing correct name is your responsibility! Probably that's something you are missing. 😉

Hope it's a bit more clear now.

View solution in original post

6 Replies 6

Здравко
Legendary | Level 20
Go to solution

@duynh7401 wrote:

I try to use this API a lot of time, but it always download a document file which I even could not open. ...


Hi @duynh7401,

Be careful what exactly you are trying download and if that what you are trying matches particular API call requirements. 😉 If you take a look on 2/files/download_zip documentation, you will see:


Download a folder from the user's Dropbox, as a zip file. The folder must be less than 20 GB in size and any single file within must be less than 4 GB in size. The resulting zip must have fewer than 10,000 total file and folder entries, including the top level folder. The input cannot be a single file.

i.e. you are trying to do something impossible!

Hope this clarifies matter.

duynh7401
Explorer | Level 4
Go to solution

Screen Shot 2022-03-31 at 07.29.09.pngHi,

What is the exactly url which I need to input the API. I want to download a folder with path is /folderName (the folder which has some subfolders in there, and it's also a root folder ) so I try to send request with a /folderName. Moreover, the problem was also happened in the upload API when I try to upload a single file using the API(https://dropbox.github.io/dropbox-api-v2-explorer/#files_upload).

Здравко
Legendary | Level 20
Go to solution

Hi @duynh7401,

While pointed path is folder everything is Ok. Let's assume you are using Dropbox application on your computer and there is Dropbox folder somewhere (doesn't matter where exactly - on default place or different one). I will mark this folder as just "Dropbox" (something typical). If I can follow your description correctly, Dropbox folder has a "folderName" subfolder, which on the other side has few more subfolders within. 🧐 Is this correct?

I assume it is. So, Yes, you should fill the path field in Dropbox API Explorer with "/folderName" (without quotes). Take in mind the resulting zip file to download will match the folder name - i.e. "folderName" - without extension by default! This might confuse your file explorer (some are too stupid and can't distinguish file type without extension). Add ".zip" to the downloaded file name (i.e. "folderName.zip") to make sure your file explorer can "understand" the file correctly. 😉 Let's hope this will fix your download issue.

I can not understand what actually fails with your upload. 🤔 You haven't added any details! Just to note that 2/files/upload can upload single file, not entire folder. Add some more details.

duynh7401
Explorer | Level 4
Go to solution

Hi @Здравко 

I mean a have a folder Q4 (like structure in the picture), I want to download it as a zip, when I use the api to download, it caused the problem. As your information, I have add .zip after the folder name (as picture) but it's still not working.Screen Shot 2022-03-31 at 11.53.49.pngScreen Shot 2022-03-31 at 11.53.58.pngScreen Shot 2022-03-31 at 11.54.06.png 

Здравко
Legendary | Level 20
Go to solution

Hi @duynh7401,

😯 Seems I was not clear enough.


Hi @Здравко wrote:

... you should fill the path field in Dropbox API Explorer with "/folderName" (without quotes). ... Add ".zip" to the downloaded file name (i.e. "folderName.zip") to make sure your file explorer can "understand" the file correctly. ...



@duynh7401 wrote:

Hi @Здравко 

... As your information, I have add .zip after the folder name (as picture) but it's still not working.

...

Screen Shot 2022-03-31 at 11.53.58.png


I haven't mentioned adding ".zip" in path field!!! Do you have a folder in your account with name "Q4.zip"?! 🧐... Of course, that's why result is "path/not found/". 😉 Path field is for the folder path, not to the downloaded file name! That's why your first call succeeds:


@duynh7401 wrote:

...

Screen Shot 2022-03-31 at 11.53.49.png

...


After this call, result gets backup in your browser; you can push "Download Q4" to get it as a file. In this particular case your browser will propose file name "Q4"; here you can add ".zip" and rename it to "Q4.zip" - at this moment (or later), not in advance! The situation is similar when you use your SDK. The data stream is just a file content, again; this stream doesn't contain file name - managing correct name is your responsibility! Probably that's something you are missing. 😉

Hope it's a bit more clear now.

duynh7401
Explorer | Level 4
Go to solution

@Здравко that's cool. Thank you a lot.

Need more support?