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.
I would like to know the MIME type, I've case where I need to handle text files (e.g. CSV) vs binary ones (e.g. PDF) differently. Wonder if there is a way to get such information? I tried to use the `getExtension` but it's returning null in my case.
I think leveraging the MIME type would be an amazing addition to the API.
I am currently building a Box-to-Laravel filesystem adapter that will not only allow token exchanges and use of Box API for Box Embed/Preview, but in many cases, it will treat Box like an S3 bucket and return temporary URLs so that users can upload, download, and view content as if it were on the server’s filesystem. It allows integration into Laravel’s Filesystem structure and lets packages “think” they are talking to S3.
One of the requirements for this, though, is that Box provide an accurate MIME type. Right now, I have to provide a fairly exhaustive list of types that I can compare to the file’s extension to act as if I am getting the correct type.