Go to <BOS-5.7-DEPLOY> \bonita_execution_engine\interfaces\REST\with_engine\bonita-server-rest.war.
Copy this as a *.war file to <JBOSS_HOME>\server\default\deploy.
Server side configuration
Configure the REST user's login and password in the JAAS configuration to be used by the server to authenticate the client's request for access. This configuration must contain the loginContext BonitaRESTServer.
<application-policy name="BonitaRESTServer">
<authentication>
<login-module code="org.ow2.bonita.identity.auth.BonitaRESTServerLoginModule" flag="required">
<module-option name="logins">restuser</module-option>
<module-option name="passwords">restbpm</module-option>
<module-option name="roles">restuser</module-option>
</login-module>
</authentication>
</application-policy>
Client side configuration
There are three types of client for the REST server:
- The Bonita User Experience in REST mode. This requires only configuration.
- The Bonita API in REST mode (Java client). This requires configuration and acknowledgment on how to use the Bonita API. (See the series Build your applications with Bonita Runtime on www.bonitasoft.org.)
- A language other than Java (HTTP client): This requires acknowledgment on the Bonita REST API.
Bonita User Experience configuration
If your client is Bonita User Experience or any Java client, configure the loginContext BonitaStore in <JBOSS_HOME>\server\default\conf\login-config.xml, according to the REST users defined in the BonitaRESTLoginModule:
<application-policy name="BonitaStore">
<authentication>
<login-module code="org.ow2.bonita.identity.auth.BonitaRESTLoginModule" flag="required">
<module-option name = "restUser">restuser</module-option>
<module-option name = "restPassword">restbpm</module-option>
</login-module>
</authentication>
</application-policy>
The client will use this login and password to request authentication with the server.
You will also have to update your server variable BONITA_OPTS to use the REST API:
set "BONITA_OPTS=-DBONITA_HOME=<JBOSS_HOME>\bonita
-Dorg.ow2.bonita.rest-server-address =<your URL> (i.e. http://localhost:8080/bonita-server-rest/)
-Dorg.ow2.bonita.api-type=REST/"
Test the REST API server
Execute a simple call to the getLightProcesses method (queryDefinitionAPI) using a rest client:
Specify URL: http://localhost:8080/bonita-server-rest/API/queryDefinitionAPI/getLightProcesses
Select POST method
For body:
Set content type to: application/x-www-form-urlencoded
Insert a header
Key: options
Value: user:admin
For authentication:
Select BASIC authentication type
Set username to: restuser
Set password to: restbpm
Run the query. You should get an empty set of processes.