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.
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.
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! 😉
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.
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.
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?