- Deploy or dispose KIE containers
- Retrieve and update KIE container information
- Return KIE Server status and basic information
- Retrieve and update business asset information
- Execute business assets (such as rules and processes)
kie-server. To view configured user roles for your jBPM distribution, navigate to ~/$SERVER_HOME/standalone/configuration/application-roles.properties and ~/application-users.properties.
To add a user with the kie-server role, navigate to ~/$SERVER_HOME/bin and run the following command:
Accept: Data format accepted by your requesting client:application/json(JSON)application/xml(XML, for JAXB or XSTREAM)
Content-Type: Data format of yourPOSTorPUTAPI request data:application/json(JSON)application/xml(XML, for JAXB or XSTREAM)
X-KIE-ContentType: Required header forapplication/xmlXSTREAM API requests and responses:XSTREAM
GET: Retrieves specified information from a specified resource endpointPOST: Updates a resource or resource instancePUT: Updates or creates a resource or resource instanceDELETE: Deletes a resource or resource instance
http://SERVER:PORT/kie-server/services/rest/, such as http://localhost:8080/kie-server/services/rest/.
Endpoints
KIE Server REST API endpoints, such as /server/containers/{containerId} for a specified KIE container, are the URIs that you append to the KIE Server REST API base URL to access the corresponding resource or type of resource in jBPM.
Example request URL for /server/containers/{containerId} endpoint
http://localhost:8080/kie-server/services/rest/server/containers/MyContainer
Request parameters and request data
Many KIE Server REST API requests require specific parameters in the request URL path to identify or filter specific resources and to perform specific actions. You can append URL parameters to the endpoint in the format ?<PARAM>=<VALUE>&<PARAM>=<VALUE>.
Example GET request URL with parameters
http://localhost:8080/kie-server/services/rest/server/containers?groupId=com.redhat&artifactId=Project1&version=1.0&status=STARTED
HTTP POST and PUT requests may additionally require a request body or file with data to accompany the request.
Example POST request URL and JSON request body data
http://localhost:8080/kie-server/services/rest/server/containers/MyContainer/release-id
Sending requests with the KIE Server REST API using a REST client or curl utility
The KIE Server REST API enables you to interact with your KIE containers and business assets (such as business rules, processes, and solvers) in jBPM without using the Business Central user interface. You can send KIE Server REST API requests using any REST client or curl utility. Prerequisites- KIE Server is installed and running.
- You have
kie-serveruser role access to KIE Server.
-
Identify the relevant API endpoint to which you want to send a request, such as
[GET] /server/containersto retrieve KIE containers from KIE Server. -
In a REST client or curl utility, enter the following components for a
GETrequest to/server/containers. Adjust any request details according to your use case. For REST client:- Authentication: Enter the user name and password of the KIE Server user with the
kie-serverrole. - HTTP Headers: Set the following header:
Accept:application/json
- HTTP method: Set to
GET. - URL: Enter the KIE Server REST API base URL and endpoint, such as
http://localhost:8080/kie-server/services/rest/server/containers.
-u: Enter the user name and password of the KIE Server user with thekie-serverrole.-H: Set the following header:Accept:application/json
-X: Set toGET.- URL: Enter the KIE Server REST API base URL and endpoint, such as
http://localhost:8080/kie-server/services/rest/server/containers.
- Authentication: Enter the user name and password of the KIE Server user with the
-
Execute the request and review the KIE Server response.
Example server response (JSON):
-
For this example, copy or note the project
group-id,artifact-id, andversion(GAV) data from one of the deployed KIE containers returned in the response. -
In your REST client or curl utility, send another API request with the following components for a
PUTrequest to/server/containers/{containerId}to deploy a new KIE container with the copied project GAV data. Adjust any request details according to your use case. For REST client:- Authentication: Enter the user name and password of the KIE Server user with the
kie-serverrole. - HTTP Headers: Set the following headers:
-
Accept:application/json -
Content-Type:application/jsonWhen you addfields=not_nulltoContent-Type, the null fields are excluded from the REST API response.
-
- HTTP method: Set to
PUT. - URL: Enter the KIE Server REST API base URL and endpoint, such as
http://localhost:8080/kie-server/services/rest/server/containers/MyContainer. - Request body: Add a JSON request body with the configuration items for the new KIE container:
For curl utility:-u: Enter the user name and password of the KIE Server user with thekie-serverrole.-H: Set the following headers:-
Accept:application/json -
Content-Type:application/jsonWhen you addfields=not_nulltoContent-Type, the null fields are excluded from the REST API response.
-
-X: Set toPUT.- URL: Enter the KIE Server REST API base URL and endpoint, such as
http://localhost:8080/kie-server/services/rest/server/containers/MyContainer. -d: Add a JSON request body or file (@file.json) with the configuration items for the new KIE container:
- Authentication: Enter the user name and password of the KIE Server user with the
-
Execute the request and review the KIE Server response.
Example server response (JSON):
If you encounter request errors, review the returned error code messages and adjust your request accordingly.REST API requests for process instancesFor REST API requests that send complex data objects to the process instance endpoint
/server/containers/{containerId}/processes/{processId}/instances, ensure that you include either the fully qualified class name (such ascom.myspace.Person) or the simple class name (such asPerson) in the request body. The class name is required for the request body to be mapped to the correct business object in jBPM. If you exclude the class name from the request, KIE Server does not unmarshall the object to the expected type.Correct request body for process instanceIncorrect request body for process instance
Sending requests with the KIE Server REST API using the Swagger interface
The KIE Server REST API supports a Swagger web interface that you can use instead of a standalone REST client or curl utility to interact with your KIE containers and business assets (such as business rules, processes, and solvers) in jBPM without using the Business Central user interface.By default, the Swagger web interface for KIE Server is enabled by the
org.kie.swagger.server.ext.disabled=false system property. To disable the Swagger web interface in KIE Server, set this system property to true.- KIE Server is installed and running.
- You have
kie-serveruser role access to KIE Server.
-
In a web browser, navigate to
http://SERVER:PORT/kie-server/docs, such ashttp://localhost:8080/kie-server/docs, and log in with the user name and password of the KIE Server user with thekie-serverrole. - In the Swagger page, select the relevant API endpoint to which you want to send a request, such as KIE Server and KIE containers → [GET] /server/containers to retrieve KIE containers from KIE Server.
- Click Try it out and provide any optional parameters by which you want to filter results, if needed.
- In the Response content type drop-down menu, select the desired format of the server response, such as application/json for JSON format.
-
Click Execute and review the KIE Server response.
Example server response (JSON):
-
For this example, copy or note the project
group-id,artifact-id, andversion(GAV) data from one of the deployed KIE containers returned in the response. -
In the Swagger page, navigate to the KIE Server and KIE containers → [PUT]
/server/containers/{containerId}endpoint to send another request to deploy a new KIE container with the copied project GAV data. Adjust any request details according to your use case. -
Click Try it out and enter the following components for the request:
- containerId: Enter the ID of the new KIE container, such as
MyContainer. - body: Set the Parameter content type to the desired request body format, such as application/json for JSON format, and add a request body with the configuration items for the new KIE container:
- containerId: Enter the ID of the new KIE container, such as
- In the Response content type drop-down menu, select the desired format of the server response, such as application/json for JSON format.
-
Click Execute and review the KIE Server response.
Example server response (JSON):
If you encounter request errors, review the returned error code messages and adjust your request accordingly.REST API requests for process instancesFor REST API requests that send complex data objects to the process instance endpoint
/server/containers/{containerId}/processes/{processId}/instances, ensure that you include either the fully qualified class name (such ascom.myspace.Person) or the simple class name (such asPerson) in the request body. The class name is required for the request body to be mapped to the correct business object in jBPM. If you exclude the class name from the request, KIE Server does not unmarshall the object to the expected type.Correct request body for process instanceIncorrect request body for process instance
Supported KIE Server REST API endpoints
The KIE Server REST API provides endpoints for the following types of resources in jBPM:- KIE Server and KIE containers
- KIE session assets (for runtime commands)
- DMN assets
- Planning solvers
- Processes
- Process images
- Process and task forms
- Tasks
- Cases
- Documents
- Jobs
- Queries for processes, tasks, and cases
- Custom queries
http://SERVER:PORT/kie-server/services/rest/. All requests require HTTP Basic authentication or token-based authentication for the kie-server user role.
For the full list of KIE Server REST API endpoints and descriptions, use one of the following resources:
- Execution Server REST API on the jBPM Documentation page (static)
-
Swagger UI for the KIE Server REST API at
http://SERVER:PORT/kie-server/docs(dynamic, requires running KIE Server)By default, the Swagger web interface for KIE Server is enabled by theorg.kie.swagger.server.ext.disabled=falsesystem property. To disable the Swagger web interface in KIE Server, set this system property totrue.
<storesvgonsave enabled="true"/> must be configured for your jBPM project in $SERVER_HOME/standalone/deployments/business-central.war/org.kie.workbench.KIEWebapp/profiles/jbpm.xml. This property is set to true by default. If the API is not working with process images, set it to true in the file, restart your KIE Server, modify the relevant process and save it, and then build and deploy your project. This property enables SVG images to be stored so that they can be retrieved by the KIE Server REST API.
Custom queries
You can use custom query endpoints to create and access custom queries in jBPM. Custom queries can request any data from the jBPM database. A number of custom queries are included in jBPM. You can use these queries to access complete lists of process instances and user tasks. When running a custom query, you must provide the name of a query mapper in themapper parameter. A mapper maps SQL query results into objects for a JSON response. You can implement your own query result mappers or use the mappers provided with jBPM. The query mappers in jBPM are similar to other object-relational mapping (ORM) providers, such as Hibernate, which maps tables to entities.
For example, if a custom query returns process instance data, you can use the org.jbpm.kie.services.impl.query.mapper.ProcessInstanceQueryMapper mapper, also registered as ProcessInstances. If a custom query returns human task data, you can use the org.jbpm.kie.services.impl.query.mapper.UserTaskInstanceQueryMapper mapper, also registered as UserTasks. You can also use other mappers that provide additional information.
For a list of query mappers that are included in jBPM, see the GitHub repository.