Identifying the MIME Type of the Attachments and Documents
Thursday, August 30, 2018 at 10:41pmHi All,
When I'm consuming the attachment requirements download API and PDF Document download API, It just gives me the stream of data. Is there anyway, that I can get the MIME type of that particular Document/Attachment?.
Thanks in Advance.
Reply to: Identifying the MIME Type of the Attachments and Documents
Friday, August 31, 2018 at 04:57amGET /api/packages/{packageId}/attachment/{attachmentId}
, you will receive the attachment(s) with the original MIME type. The response content-type isapplication/octet-stream
and you just need to store file name with the corresponding extension type or directly open the API url in your browser. Attachment 1 is a screenshot of response OSS will send back to you when you call this API. I also created some snippet for you to download the attachment in REST method in Java in attachment 2. If you are usingGET /api/packages/{packageId}/attachment/zip
, the MIME type will beapplication/zip
, and when you unzip the file, attachment(s) will be in original type. BTW, the types allowed to upload as an attachment are: PDF, DOC, DOCX, RTF, ODT, JPG, JPEG, PNG, BMP, TXT, XLS, XLSX. And for the documents in your transaction, I think they can only be downloaded with PDF type as all audit trails have to be sealed into the PDF that's why it can't be downloaded as the original type. Even if you are usingGET /packages/{packageId}/documents/{documentId}/original
, the file will still be in PDF type. Hope this could help you! DuoReply to: Identifying the MIME Type of the Attachments and Documents
Friday, August 31, 2018 at 05:00am