Posted: 25 Oct 2016 4:49 EDT Last activity: 31 May 2017 4:27 EDT
How to download a file( binary stream) received from external system REST Service response in Pega application
We have a requirement to search and download a document/file from an external system which exposed a REST API.
In pega(v7.1.7), we have created a CONNECT-REST to call this REST API and tried to access document from external system. We are able to search the documents Metadata( which is in JSON format) by mapping response to JSON.
But we are not able to download the file when tried the appropriate download function of externa API. However if we try the external API download URL in broswer it prompt the file download option.
We need the same(download prompt) from Pega screen, while user take download action and pega calls external download API via CONNECT-REST.
Does any body implement this with CONNECT-REST? Please suggest any way to solve this problem.
Yeah, I think, by using PublicAPI.sendFile() in an activity to send the file content will prompt for download dialog at client. For more details, please refer EngineAPI documentation available in DesignerStudio.
you can capture the response url of metadata and use 'Open URL in window' action on click event of any button or link. Or you can write a similar activity as 'DownloadFile' which will download the file from service export location.