cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
If you’ve changed your email address, now's the perfect time to update it on your Dropbox account and we’re here to help! Learn more 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 file from dropbox to my webapp on behalf of user(after he successfully authenticate)

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

AmitSingla
Explorer | Level 3

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 5

Greg-DB
Dropbox Staff

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
Explorer | Level 3

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

Greg-DB
Dropbox Staff

Yes, if you just need a way to get a file from the user's Dropbox account into your web app by having the user select it, the Dropbox Chooser may be a good option. You can find the information on using the Chooser here.

qa7641
New member | Level 2

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

Greg-DB
Dropbox Staff

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

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    qa7641 New member | Level 2
  • User avatar
    AmitSingla Explorer | Level 3
What do Dropbox user levels mean?