Hi, i would like to create REST API Extension for Bonita that can return file (to download). I stores files on a server machine and on call GET MyRestApiExtension Service i would like to server file, that can be download. On RestApiResponseBuilder i set mediaType n application/octet-stream and i also add additional header "Content-Disposition" but i have problem to server files bytes to response.
I dig on your use case and actually found a limitation of the REST API extension. Currently (in Bonita 7.8.2 and previous versions) a REST API extension can only returns a response with text body. It is not possible to return octect streams that is required to be able to download all types of files.
I can post here the code that will let the user download any text files:
You can declared in your process definition "documents" and initialize them using the file content available on the server (or directly embedded the file in the process definition). Then you can add download link in Bonita forms for document.
You can setup a web server (e.g. Apache HTTPD) to serve the file and includes links in the Bonita forms.
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.