cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: 

Download folder as ZIP in api v2?

Download folder as ZIP in api v2?

tim
Explorer | Level 4
Go to solution

One of my apps that i'm trying to migrate from API v1 to v2 uses the v1 functionality where you can download https://content.dropboxapi.com/1/files/auto/path/to/folder, and dropbox sends you a ZIP file so long as the contents of the folder are small enough.

 

Has the auto-zip functionality been completely removed in API v2 or is there some way to get that functionality?

 

thanks.

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

Hi Tim, API v2 doesn't offer zip folder downloads, but I'll pass this along as a feature request.

 

(Also, I'm not sure exactly what functionality you're referring to on v1, as there's no documented/supported zip folder download functionality on the /files endpoint you're referring to. Perhaps you're referring to the ability to download a zip from a shared link for a folder using the dl or raw URL parameters? That's unrelated to API version.)

View solution in original post

7 Replies 7

Greg-DB
Dropbox Staff
Go to solution

Hi Tim, API v2 doesn't offer zip folder downloads, but I'll pass this along as a feature request.

 

(Also, I'm not sure exactly what functionality you're referring to on v1, as there's no documented/supported zip folder download functionality on the /files endpoint you're referring to. Perhaps you're referring to the ability to download a zip from a shared link for a folder using the dl or raw URL parameters? That's unrelated to API version.)

Greg-DB
Dropbox Staff
Go to solution
The Dropbox API v2 now offers the ability to download folders as zips:

https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip

If you're using an official SDK, there will also be a corresponding method for this endpoint.

saifnirob
New member | Level 2
Go to solution

I may have a question in the same category or case! I use the premium version of Dropbox with my another business account with Dropbox. I am developing a portal for my client where I want to give my client an option to download bigger files like 5GB. So, what you think is it possible with v2 api to let my client download 5gb files at a time using direct download?

If no, what is the maximum limit of download zip at a time or how much file size can handle v2 api to download at a time?

Greg-DB
Dropbox Staff
Go to solution

@saifnirob Using /2/files/download, there isn't any file size limit for downloading individual files. (It also supports Range retrieval requests.)

 

The /2/files/download_zip endpoint, for downloading entires folders as zips, however, does have some limitations. You can find information on those in the documentation.

frphotos
Explorer | Level 4
Go to solution

Okay. I am sharing this code for people who needs to download dropbox folder as zip in C#. I can't find a solution in the web and I have to piece up my own code. Hope it helps.

 

 

private async Task Download(string foldername)
{
string token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; var dbx = new DropboxClient(token); using (var response = await dbx.Files.DownloadZipAsync("/" + foldername)) { Stream ms = await response.GetContentAsStreamAsync(); Int16 bufferSize = 1024; byte[] buffer = new byte[bufferSize + 1]; Response.Clear(); Response.ContentType = "application/x-zip-compressed"; Response.AddHeader("content-disposition", "attachment; filename=myfolder.zip"); Response.BufferOutput = false; int count = ms.Read(buffer, 0, bufferSize); while (count > 0) { Response.OutputStream.Write(buffer, 0, count); count = ms.Read(buffer, 0, bufferSize); } } }

//To call it, place the download function in a page_load of a aspx (example: download.aspx)
//Link example: http://domainname/download.aspx?folder=abc123
//This link will directly download the folder as a zip file.

protected void Page_Load(object sender, EventArgs e)
{
string dropbox_folder = Request.QueryString["folder"];
if (dropbox_id == null)
Response.Redirect("http://google.com");
try
{
var DownloadTask = Task.Run(async () =>
{
await Download(dropbox_folder);
});
DownloadTask.Wait();
}
catch (Exception ex)
{
Response.Redirect("http://google.com");
}
}

 

 

 

cutch2222
Explorer | Level 4
Go to solution

I am confused as to what the "version" is above this download_zip documentation (It says Version1 -- however it is on the Dropbox API v2 page.

TaylorKrusen
Dropbox Staff
Go to solution

Our apologies if the terminology is confusing. 

We actually have two ways of versioning our API. One is the overall API version. The second (and the one you mention in your post) refers to the endpoint itself and has its own versioning. 

In other words, you're using v2 of the overall API, but v1 of the download_zip endpoint.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    TaylorKrusen Dropbox Staff
  • User avatar
    cutch2222 Explorer | Level 4
  • User avatar
    frphotos Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    saifnirob New member | Level 2
What do Dropbox user levels mean?