Forum Discussion

frphotos's avatar
frphotos
Explorer | Level 4
8 years ago

c# Files.DownloadZipAsync, how do I get link from this Api call?

When I call this API endpoint "Api.Files.DownloadZipAsync", why am I not getting any link to the zip file?

Instead I am getting name, path_lower, path_display, id.

 

When I run it on the API explorer, it formed a link in the button below ... something like "blob:https://dropbox.github.io/e05a95ca-8ff7-473b-93ec-b339db391dde"

 

How do I form this download link?

 

Am I doing something wrong?

 

Below is my code snippet

using (var dbx = new DropboxClient(token))
{
     zipdownload = await dbx.Files.DownloadZipAsync("/fr_test");
}

3 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    The DownloadZipAsync method will return the zip data directly to your app. It does not itself return a link to the data. You can have your app do whatever you want with it (e.g., serve it back to the user, save it locally, etc.). You can find an example of accessing the data here:

     

    https://github.com/dropbox/dropbox-sdk-dotnet/blob/23b85606c92fc05fc1e6a2da4c6d10662b0c8683/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L369

     

    (That's an example of using DownloadAsync, but accessing the data works the same way for DownloadZipAsync.)

     

    The API v2 Explorer, for instance, takes the returned zip data, and makes it available to the user via a blob URL directly in the browser. This isn't part of the API itself, but rather just something implemented in the API v2 Explorer itself as a convenience to developers using it to test the API.

  • frphotos's avatar
    frphotos
    Explorer | Level 4
    8 years ago

    A quick question, I am using this Files.DownloadZipAsync inside a web application.
    Once I obtain the data from "await response.GetContentAsStringAsync();"
    How do I convert the stream data to be a physical url link like how the API v2 Explorer did via a blob URL?

     

    Any leads to an example or method resources would be great.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    The ability to create a blob URL is something native to browsers. You're writing in C#/.NET, outside of a browser, so this will work very differently.

    Exactly how you do something like that will also depend on your scenario. For example, since you're building a web app, you can use your web framework to make the data available at some URL. That's outside of what I can help with as Dropbox API support, so I recommend referring to the documentation for the web framework that you're using.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!