Upload servlets for the REST API expecting files
For all the REST APIs expecting a file path it is required to upload the file using one of the provided upload servlets first.
To upload a file you need to perform a multipart post request on any of the available servlets. It returns the name of the temporary uploaded file. This file name can be used to link those files with any REST resources.
Available servlets
-
/portal/fileUpload
, supports any type of files -
/portal/processUpload
, supports only.bar
files -
/portal/organizationUpload
, supports only.xml
files -
/portal/actorsUpload
, supports only.xml
files -
/portal/imageUpload
, supports only.png
,.jpg
,.gif
,.jpeg
,.bmp
,.wbmp
or.tga
files -
/portal/pageUpload
, supports only.zip
files -
/portal/applicationsUpload
, supports only.xml
files -
/portal/connectorImplementation
, supports only.zip
files (not available in Community edition) -
/portal/reportUpload
, supports any type of file (not available in Community edition) -
/portal/resourceUpload
, supports only.jar
files (not available in Community edition) -
/portal/profilesUpload
, supports only.xml
files (not available in Community edition) -
/API/formFileUpload
, supports any type of files, used to upload a file before submitting a process or task form with a document in its contract
For |
Example
You can refer to the example-upload-servlet project that demonstrate the two use cases explained below.
Link an icon to a new organization group
-
Call the login service:
/bonita/loginservice
for authentication. -
Upload an image by using a multipart post request on the image upload servlet,
/bonita/portal/imageUpload
. -
The image is stored in a temporary folder.
-
The servlet call response includes the name of the temporary file.
-
Call the Identity API to create a new group:
/bonita/API/identity/group
, link this image to the group by specifying this temporary file name in the request body.
Deploy programmatically a new REST API extension
-
Call the login service:
/bonita/loginservice
for authentication. -
Upload a REST API extension by using a multipart post request on the page upload servlet:
/bonita/portal/pageUpload
. It will send the REST API extension (handle as a "page") zip file from client side to server side. -
REST API extension zip file is stored in a temporary folder.
-
The servlet call response includes the name of the temporary file.
-
Call the Portal API to register the newly uploaded REST API extension:
/bonita/API/portal/page
.