How to get the file's MIME type from box developer application using Box Java SDK ?
Hi all,
I'm developing a java application to fetch box documents/files properties/Info. I'm able to get most of the file properties/Info except MIME type of the files.
Is it possible to directly get the MIME type of a document/file using Box Java SDK ?
Please suggest your suggestion.
Thank you,
Arpit
-
Hi ,
Thanks for reaching out! Unfortunately we don't return MIME types. The extent of what we return is listed in the table/description of the file object here:
https://developer.box.com/reference#file-object
I'm curious to hear what your use case is for this? Additionally, has anyone else from the community here been looking for this too? If so, please let us know!
Thanks,
Jason
-
I just stumbled on this post while also looking for the way in which the Java SDK provides the file content type. It is surprising to find that this functionality isn't provided as it is a fundamental concept of HTTP resources. The storage services for both AWS and Azure support both specifying and retrieving resource content type through their respective Java SDKs.
Snooping with dev tools in the browser I can see that the Content-Type is being set when I download a file. I do not know if you are storing the content type from upload or if you are just guessing it from the extension + content sniffing. It would be useful to expose the same content type via the file objects return from API.
The simplest use case would be downloading a file from box and uploading to another service as a resource over a REST API. From box we'll need a minimum of the content type and content stream.
Please sign in to leave a comment.
Comments
3 comments