Read an uploaded file


In an instanciation form, I use the widget "Upload" to join an Excel file using the URL/ "../API/formFileUpload".
I would like to read it with a Rest API extension in order to return is content as a JSON.

I know how to read and to access a document attach in a process by calling the method "apiAccessor.getProcessAPI().getDocumentContent()" but I don't know how to do the same in a RestAPI :

  • Should I use the filename or tempPath as input parameter to access the file ?
  • The file has no storage id
  • The case doesn't exist yet


Submitted by adrien.lachambre on Fri, 04/05/2019 - 17:11

Hi David,

Just to be sure that I understood well your use case, you would like to upload a file with the file upload widget in a form, and before to submit the form you would like to send the content of this uploaded file to a REST API extension to parse its content ?


Submitted by david.combe on Fri, 04/05/2019 - 17:13

Yes, it's what I tried to do

1 answer


Bonita doesn’t provide any API to retrieve temporary files on the server, it would lead to to many security issues.

I suggest you to define your REST API extension as the URL endpoint of the file upload widget (using the property URL). 
Your REST API extension must be a POST method.

The content of your file will be in the body of the request, you can retrieve it using request.getReader() or request.getInputStream(), and then parse it.

Be aware that it is not recommended to perform write operations in a REST API, write operations should be performed by processes.


Submitted by morongarciakaty... on Sun, 04/07/2019 - 03:59

En un formulario de instanciación, utilizo el widget "Cargar" lo que quiero es que en otra tarea pueda visuaizar ese archivo ayuda porfa estoy usando bonita 7 soy nueva