cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out 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: 

Can I have the user log into their Dropbox and uses it to upload image file and my app can grab it?

Can I have the user log into their Dropbox and uses it to upload image file and my app can grab it?

do-kevin
Explorer | Level 4

Hey there,

I'm not familiar with the API yet, but I was wondering if the API allows my users to log into their Dropbox account to upload (image) files to their Dropbox and my app could pull those files from their Dropbox to display in the front end?

 

I also want to define a directory for the user's Dropbox in which their files would be uploaded into.

5 Replies 5

Re: Can I have the user log into their Dropbox and uses it to upload image file and my app can grab

Здравко
Super Collaborator | Level 20

Hi @do-kevin,

Not just allows! Primary target of Dropbox API is letting application access to Dropbox space of user. What else could be?!

On application creation time you can select wheter your application need access to entire user account at all or predefined application related namespace (application folder actually) where application could store whatever need.

Hope this helps.

Re: Can I have the user log into their Dropbox and uses it to upload image file and my app can grab

do-kevin
Explorer | Level 4

Thanks , what about the ability to display the file, especially an image (.jpg, etc...), back to the front end?

So far, from what I gather from API explorer, I can only get the link to download the (image) file and .jpg is not supported

for the preview endpoint.

Re: Can I have the user log into their Dropbox and uses it to upload image file and my app can grab

Здравко
Super Collaborator | Level 20

Hi @do-kevin,

I should confess that I can't be sure what you mean. 🤔 If you mean download a prepared file image in advance, there are no any restriction! Any file, including any image format gets treat from 'download' API call as just a piece of data. Nothing more! The same is valid If you want to use a shared link. 🤷 If you mean usage of thumbnail preview, supported source format (not only images) could be converted only to jpg (the default) or png using 'get_thumbnail' API call. Exactly what you need! 😉

Hope this clarifies matter.

Re: Can I have the user log into their Dropbox and uses it to upload image file and my app can grab

do-kevin
Explorer | Level 4

Hey ,

 

I've missed the get_thumbnail and download endpoints. Thanks, this seems closer to what I'm trying to do. Sorry

for the confusion. I'm just using the API explorer and it doesn't look like it's displaying the data I need; it's only showing

a button to download a file after a successful call.

 

So I want to display the image files in HTML. Do these API calls, like get_temporary_link, return a link I can use?

Or do they return file data that I will have to convert?

 

Thanks again,

Kevin

Re: Can I have the user log into their Dropbox and uses it to upload image file and my app can grab

Здравко
Super Collaborator | Level 20

Hi @do-kevin,

Seems you haven't read Dropbox API documentation carefully enough. 🤷 At the very beginning different types of API call formats are described. Could be grouped as RPC calls (linkrelated calls for example - api.dropboxapi.com domain) and content related calls (all APIs dealing with content - including upload download etc. - content.dropboxapi.com domain). RPC calls are simpler call with a single set of arguments and single set response block. That's why arguments are passed just as a POST request body content and result get back just as a response body and that's all. Content related calls, together with call arguments and call response, have to deal with corresponding content (either to upload or download). That's why, in such API calls, arguments are passes as 'Dropbox-API-Arg' request header and the request body gets free for eventual upload content and results are passed back as 'Dropbox-API-Result' response header when body has to gets released for downloaded content. 😉


@do-kevin wrote:
... I'm just using the API explorer and it doesn't look like it's displaying the data I need; it's only showing

a button to download a file after a successful call.

...

Hope, following the above, you can understand what is that button for - there are 2 responses actually! One is clear text and the other actual file content (could be anything - better be assumed binary) and no convenient universal way to display. That's why there is a button for download, so you would be able investigate, whatever needed. That's it.

 


@do-kevin wrote:

...

So I want to display the image files in HTML. Do these API calls, like get_temporary_link, return a link I can use?

Or do they return file data that I will have to convert?

...


The API calls I discussed above return target file raw content (whatever is - image in you case). You can directly forward that content to... wherever needed - I can't understand what kind of conversion you are thinking of. 🧐 If you need some dynamic content (code keeping image, for example), better use corresponding libraries - there are lots.

If you need links, as I mentioned before, there isn't any type restriction. A temporary link received using 'get_temporary_link' API call is convenient for update some cached content, once a change gets catched in your code algorythm. Take in mind that temporary links usage for embed in HTML in client browser is NOT a good idea! Such practice can dramatically degrade web page loading speed, so if not need for some other reason, better reconsider its usage. Better alternative is usage of persistent links received using 'create_shared_link_with_settings'. Such use lets client browser optimize download page content. 😉 To avoid continious generating of 'shared_link_already_exists' error, you can organize you application run flow so create a link once, on first file appearence and receive the already created link on every usage using 'list_shared_links' API call. Take in mind persistent shared links are preview links - they open browser view where pointed file can be previewed, if possible, and eventually downloaded (i.e. they point to HTML, not to the actual file). To change this, you should change link parameter (on receiving, link ends with "?dl=0" parameter). To get link to the raw content (to the image in your case) just replace ending "?dl=0" to "?raw=1".

Hope the possible paths of your application are traced in details already.

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Здравко Super Collaborator | Level 20
  • User avatar
    do-kevin Explorer | Level 4
What do Dropbox user levels mean?
Need more support?