Sending documents to external system through a WebAPI call

Hello, Is it possible to send documents to an external system through a WebAPI call? I was playing with http response header 'Content-Disposition' with header value being ' attachment; filename=finename.pdf" '. But I don't get to understand how to embed a document from Appian 'content management system' either as a response header or body. When a call this API with this partial set up, the browser does at-least initiates a file download which I can't open(as I never really attached a file in response!). Is it even possible at all? Should the documents be attached in headers or body and how? Thanks for helping...

Here is the response I'm trying to prepare and see how I've embedded document object inside body. I'm sure this is not how it should be done, but I hope it will convey my intentions.

a!httpResponse(
headers: {
a!httpHeader(
name: "Content-Type",
value: "application/text"
),
a!httpHeader(
name: "Content-Disposition",
value: "attachment; filename=" & char(34) & local!username & ".txt" & char(34)
)
},
body: {
todocument(121330)
}
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi  As of now, there are no such way to send a document to an external system through Web-API, but yes you can have a try on this. You can try the following approach for your R&D purpose, before we come to a conclusion:

    => Try to convert the document to Base64 format, and send this as an input to the External System using Web-API through POST call.
    => Once the content got Delivered to External Service, you need to again convert this Base64 to Document.

    Problem Statement in this approach:
    => Conversion of Document to Base64 in Appian
    => The External System must be capable of converting Base64 to Document again.

    Hope this information will help you.

  • Please note that I also want this service to be available to client side user as a clickable link, where, user may want to click this service URL anticipating to download a document. In this case, I don't think we can ingest any base64 conversion mechanisms into this model, can we?
Reply Children