We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
mwatt776
4 years agoExplorer | Level 4
View File Content through API
I want to access the contents of a private file in my Dropbox account so I can display the contents on my website. I am using the files/download method and receiving the expected response outline in ...
Greg-DB
Dropbox Community Moderator
4 years agoThe /2/files/download endpoint is a "content-download" style endpoint, so the file content is returned in the response body (not a header). Refer to your client's documentation for information on how to read the data from the response body.
- mwatt7764 years agoExplorer | Level 4
This is all I can find in the documentation:
"Content-download endpoints
As with content-upload endpoints, arguments are passed in the Dropbox-API-Arg request header or arg URL parameter. The response body contains file content, so the result will appear as JSON in the Dropbox-API-Result response header. These endpoints are also on the content.dropboxapi.com domain."
I don't know how much of Dropbox-API-Result I can show here but it has the following keys for me: name, path_lower, path_display, id, client_modified, server_modified, rev, size, is_downloadable, content_hash.
Do any of the keys allow me to access the file content?
- Здравко4 years agoLegendary | Level 20
Hi mwatt776,
As you mentioned that metadata are not of interest for you, why are you observing "Dropbox-API-Result" header? There are only metadata and it's a response header (one of some number of headers in the response header block), NOT a response body. As Greg mentioned, file content (you are interested in) is presented in the response body, NOT the in whatever header in header block! See in documentation, how you can get in touch to the body of HTTP response in your environment. Don't mess response body with "Dropbox-API-Result". 🙂 They are different things! No one key will let you access to the body - it's just not in the same place.
Good luck.
- mwatt7764 years agoExplorer | Level 4
I think I found the response body but it looks like junk. In the response header, it says the Content-Type is application/octet-stream. How can I receive the file content in plain text?
About 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!