Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.
Forum Discussion
mwatt776
3 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 ...
Здравко
3 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.
mwatt776
3 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?
- Здравко3 years agoLegendary | Level 20
mwatt776 wrote:I think I found the response body but it looks like junk. ...
Hi again mwatt776,
I don't know what you mean "junk" here. 🤔 Dropbox gives you exactly what you point to (and uploaded before, of course), nothing more or less. Either using API or some other way.
mwatt776 wrote:... In the response header, it says the Content-Type is application/octet-stream. ...
Yes, that's right. As I mentioned, API doesn't play with your data in any way (if not explicitly requested somehow - download is not such a way), rather treats data as a "closed case in a black box" that has to be transferred (whatever is the actual data type - including if it's a plain text). That's why when you transfer something it's denoted as an "application/octet-stream", whatever it's actually (plain text, formatted text, image of different type, clip file, etc). Don't rely on "Content-Type" header to figure out actual type; that's what metadata are for (even they are not so reliable). Better just ignore this header in the response; 🙂 it's always the same on successful call.
mwatt776 wrote:... How can I receive the file content in plain text?
As I mentioned, you are receiving exactly what you've queried, nothing more or less. According to your first post here, you are downloading ".docx" file. Is it still so? If so, this format is definitely not a plain text! Why you're expecting plain text in such a situation? If you want plain text, save a plain text file and download it (save the docx as txt or html, for instance) and make sure you can open this file in plain text editor in advance. 😉 Can you open docx in a plain text editor? 🧐 Rhetorical question of course. 😁
Hope this helps.
- mwatt7763 years agoExplorer | Level 4
The only reason I am use files/download is because I read that you can somehow get the content of the file this way. My goal is to get the text from a docx file on Dropbox to display on my website. Any tips on how I can do this? I do not want to use the embedder because it does not let me customize the iframe. I do not want the logo and background or anything else in the iframe, just the text.
- Здравко3 years agoLegendary | Level 20
mwatt776, your question goes out of Dropbox API matter. As I said Dropbox API just brings to you the actual file content (in particular docx which is not a plain text). What you're going to do further is up to you. You can consider where format transformation should be performed (server side or user browser, for example) - solutions can differs. There are different ways to perform such a thing in any situation/place. Some googling might surprise your. 🙂 Only as an example, take a look here. Don't be lazy, check some others too, to figure out what best matches your needs. 😉
Good luck.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,039 PostsLatest Activity: 3 hours ago
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!