rchoucroun wrote:
I would like to return the data download as part of the app response, if possible.
Hi @rchoucroun ,
If possible I would recommend combining the two workspaces so that the output is being written directly in the first workspace which can then make use of the Data Download Service, this would likely be the simplest approach.
However if that is not an option I would suggest:
- Open the Run Workspace page in FME Server, and point it to the workspace you are currently submitting in the FMEServerJobSubmitter, do not run the workspace, instead in the top right-hand corner select Workspace Actions > Create Webhook
- Once the Webhook is created copy the URL under the heading 'Authorization with Query String'. This generates a URL that will allow you to submit the job via the Data Download service rather than REST
- In your workspace replace the FMEServerJobSubmitter Transformer with a HTTPCaller, set the Request URL to the URL created in step 2, and set the HTTP Method to Post.
- When you run this workspace, the output from the HTTPCaller will be a response_body attribute, this will contain the HTML response that you would get if you run the URL directly in the web browser, and it includes the data download URL.
- Update the response body attribute to have the name html_content and then connect an HTML Writer to the workspace.
- Publish the workspace under the Data Streaming Service, now when it is run as the server app, the response from the nested workspace will be returned in the UI.
The ability to chain workspaces in Server Apps is something that our team is currently investigating, so I'll be sure to add this use case to their notes and hopefully, this is something we can make easier in the future.