25.2. Sending requests with the Decision Manager controller REST API using the Swagger interface
The Decision Manager controller 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 Server templates, instances, and associated KIE containers in Red Hat Decision Manager without using the Business Central user interface.
By default, the Swagger web interface for the Decision Manager controller is enabled by the org.kie.workbench.swagger.disabled=false system property. To disable the Swagger web interface for the Decision Manager controller, set this system property to true.
Prerequisites
- The Decision Manager controller is installed and running.
-
You have
rest-alluser role access to the Decision Manager controller if you installed Business Central, orkie-serveruser role access to the headless Decision Manager controller installed separately from Business Central.
Procedure
In a web browser, navigate to
http://SERVER:PORT/CONTROLLER/docs, such ashttp://localhost:8080/decision-central/docs, and log in with the user name and password of the Decision Manager controller user with therest-allrole or the headless Decision Manager controller user with thekie-serverrole.注記If you are using the Decision Manager controller built in to Business Central, the Swagger page associated with the Decision Manager controller is identified as the "Business Central API" for Business Central REST services. If you are using the headless Decision Manager controller without Business Central, the Swagger page associated with the headless Decision Manager controller is identified as the "Controller API". In both cases, the Decision Manager controller REST API endpoints are the same.
-
In the Swagger page, select the relevant API endpoint to which you want to send a request, such as Controller :: KIE Server templates and KIE containers
[GET] /controller/management/servers to retrieve KIE Server templates from the Decision Manager controller. - Click Try it out and provide any optional parameters by which you want to filter results, if applicable.
- 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):
{ "server-template": [ { "server-id": "default-kieserver", "server-name": "default-kieserver", "container-specs": [ { "container-id": "employeerostering_1.0.0-SNAPSHOT", "container-name": "employeerostering", "server-template-key": { "server-id": "default-kieserver", "server-name": "default-kieserver" }, "release-id": { "group-id": "employeerostering", "artifact-id": "employeerostering", "version": "1.0.0-SNAPSHOT" }, "configuration": { "RULE": { "org.kie.server.controller.api.model.spec.RuleConfig": { "pollInterval": null, "scannerStatus": "STOPPED" } }, "PROCESS": { "org.kie.server.controller.api.model.spec.ProcessConfig": { "runtimeStrategy": "SINGLETON", "kbase": "", "ksession": "", "mergeMode": "MERGE_COLLECTIONS" } } }, "status": "STARTED" }, { "container-id": "mortgage-process_1.0.0-SNAPSHOT", "container-name": "mortgage-process", "server-template-key": { "server-id": "default-kieserver", "server-name": "default-kieserver" }, "release-id": { "group-id": "mortgage-process", "artifact-id": "mortgage-process", "version": "1.0.0-SNAPSHOT" }, "configuration": { "RULE": { "org.kie.server.controller.api.model.spec.RuleConfig": { "pollInterval": null, "scannerStatus": "STOPPED" } }, "PROCESS": { "org.kie.server.controller.api.model.spec.ProcessConfig": { "runtimeStrategy": "PER_PROCESS_INSTANCE", "kbase": "", "ksession": "", "mergeMode": "MERGE_COLLECTIONS" } } }, "status": "STARTED" } ], "server-config": {}, "server-instances": [ { "server-instance-id": "default-kieserver-instance@localhost:8080", "server-name": "default-kieserver-instance@localhost:8080", "server-template-id": "default-kieserver", "server-url": "http://localhost:8080/kie-server/services/rest/server" } ], "capabilities": [ "RULE", "PROCESS", "PLANNING" ] } ] }-
In the Swagger page, navigate to the Controller :: KIE Server templates and KIE containers
[GET] /controller/management/servers/{serverTemplateId} endpoint to send another request to create a new KIE Server template. Adjust any request details according to your use case. Click Try it out and enter the following components for the request:
-
serverTemplateId: Enter the ID of the new KIE Server template, such as
new-kieserver. - 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 configurations for the new KIE Server template:
{ "server-id": "new-kieserver", "server-name": "new-kieserver", "container-specs": [], "server-config": {}, "capabilities": [ "RULE", "PROCESS", "PLANNING" ] }-
serverTemplateId: Enter the ID of the new KIE Server template, 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 confirm the successful Decision Manager controller response.
If you encounter request errors, review the returned error code messages and adjust your request accordingly.