Download File REST API Operation
If your REST API need return a file to the client download, this is the source code that you could write (P.S.: extracted from the question https://community.intersystems.com/post/download-file-rest and its responses):
Set%response.ContentType="image/jpeg"
Do%response.SetHeader("Content-Disposition","attachment;filename=""test.jpg""")
Set%response.NoCharSetConvert=1
Set%response.Headers("Access-Control-Allow-Origin")="*"
Setstream=##class(%Stream.FileBinary).%New()
Setsc=stream.LinkToFile("/opt/irisbuild/output/test.jpg")
Dostream.OutputToDevice()
SettSC=$$$OK
Discussion (0)1