Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.

Forum Discussion

AmitSingla's avatar
AmitSingla
Explorer | Level 3
5 years ago

Download file from dropbox to my webapp on behalf of user(after he successfully authenticate)

Hello Dropbox team,

I have a usecase, where in my webApp (Node js - Angular), user will come and select "dropbox" icon, which will open Dropbox Authentication window, for the user to authenticate.

Once he is authenticated successfully, then the file selected by user from dropbox, should get downloaded to my server (webapp).

I saw documentation on dropbox at this page: https://www.dropbox.com/developers/documentation

But there are 2 ways to achieve the download,  - 

  • HTTP reference
  • API Explorer

I found there is an api to download the file: https://content.dropboxapi.com/2/files/download

But I have couple of questions:

  1. Could you please send me some example on how to achieve this use case. (Especially, how my webapp can access (read-only) to user file there in dropbox, and then subsequently downloading it)
  2. HTTP is better or API is better. (HTTP Reference is more like REST Api to download the file, but if I use API explorer as SDK, then I need to keep on updating the SDK version every other time)
  3. In this download API, there is a header argument called "path", which is the path of file location. (How would my webapp will come to know the path of file ? I mean, before downloading the file, how to get the path of the file, in order to download.

Please provide some example to handle this usecase.

 

5 Replies

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

    As you found, Dropbox does offer an API you can use for listing, uploading, and downloading files, among other operations. You can find everything you need to get started with the Dropbox API, including documentation, tutorials, and SDKs here.

     

    To clarify though, the API Explorer is just a tool meant to make it easy to experiment with the Dropbox API. The Dropbox API itself consists of the HTTPS endpoints, which are documented here. You can use the API Explorer to test out the Dropbox API, but it's not meant as a way to integrate with the API in your actual app.

     

    The Dropbox API can be used by any platform that can make HTTPS calls. You can call the HTTPS endpoints directly, but we do recommend using one of the official SDKs, if possible, as they will do much of the work for you.

     

    If you're just getting started with the Dropbox API, you may want to check out the Getting Started guide first to get a basic understanding of how to use it.

     

    Anyway, as you mentioned, to download a file via the API, you would use the /2/files/download endpoint, or the corresponding native method in an SDK, if you're using one. That takes a "path" parameter which is how the app specifies which file is wants to download. This may determined by the app's logic, or selected by the user. I recommend reading the File Access Guide for information on navigating and interacting with paths and files on the Dropbox API.

     

  • AmitSingla's avatar
    AmitSingla
    Explorer | Level 3
    5 years ago

    Basically, in my usecase, user will login to dropbox and select file. Once he selects the file from dropbox, file should get downloaded automatically to our webapp(server).

    I was reading dropbox documentation, and found that, there is pre-built component called "Chooser".

    I was thinking, probably, this would help in my usecase.

     

    Thanks

    Amit

  • qa7641's avatar
    qa7641
    New member | Level 2
    4 years ago

    I saw that dropbox chooser is not available for angular, what to do then ? @Amit how did you solve this ?

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

    qa7641 Dropbox still doesn't offer support for using the Dropbox Chooser in Angular, but I'll pass this along as a feature request. I'm not aware of any plans for that currently though.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,038 PostsLatest Activity: 6 years ago
415 Following

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 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!