We have an integration object that calls an API that returns a document. So far we only needed PDF so we hardcoded the extension to .PDF. Now we can also receive a TXT file that contains JSON data in it. What is the best way for us to dynamically set the extension depending on the document that we receive? The integration team added the Content-Type to the HTTP headers but when I remove the .pdf, the document extension is set by Appian to .bin. (The txt file is getting set to .json) Any recommendations on how to best implement this?
Discussion posts and replies are publicly visible
Hey there! The Content-Type header actually isn't used to infer the extension. We use the Content-Disposition header.
You're correct that you should remove the extension from the Document Name and Extension field (for example, "My Document")
Sending a Content-Disposition header with a value of inline; filename="resume.txt" would result in a document called MyDocument.txt
Sending a Content-Disposition header with a value of inline; filename="resume.pdf" would result in a document called MyDocument.pdf
Hope this helps!
Colton Walker thanks for the quick response. Can the integration team pass in any value for filename (ensuring that the file extension is correct)? And in the Integration object in Appian the file name would be overwritten with the value we enter in Document Name and Extension?
Yep, that's correct!