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 Reply Children