We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

duynh7401's avatar
duynh7401
Explorer | Level 4
3 years ago

Problem with download a folder as a zip with API

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

 

  • 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.

    ...


    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:

    ...

    ...


    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.

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    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's avatar
      duynh7401
      Explorer | Level 4

      Hi,

      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).

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 3 hours ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!