Chapter 17. The REST API for Intelligent Process Server Administration

This section provides information about the Rest API for both managed and unmanaged Intelligent Process Server environments. You must set correct HTTP headers for the servers. See REST API for Intelligent Process Server Execution section for further information about HTTP headers.

17.1. Managed Intelligent Process Server Environment

When you have a managed Intelligent Process Server setup, you need to manage Intelligent Process Server and containers through a controller. Usually, it is done through Business Central, but you may also use Controller REST API.

  • The controller base URL is provided by business-central war deployment, which is the same as org.kie.server.controller property (for example http://localhost:8080/business-central/rest/controller).
  • All requests require basic HTTP Authentication or token-based authentication for the role kie-server.

    [GET] /management/servers

    Returns a list of Intelligent Process Server templates.

    Example Server Response

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <server-template-list>
        <server-template>
            <server-id>local-server-123</server-id>
            <server-name>local-server-123</server-name>
            <container-specs>
                <container-id>hr</container-id>
                <container-name>hr</container-name>
                <server-template-key>
                    <server-id>local-server-123</server-id>
                    <server-name>local-server-123</server-name>
                </server-template-key>
                <release-id>
                    <artifact-id>EmailProject</artifact-id>
                    <group-id>org.redhat.gss</group-id>
                    <version>1.0</version>
                </release-id>
                <configs>
                    <entry>
                        <key>RULE</key>
                        <value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                            <pollInterval>500</pollInterval>
                            <scannerStatus>STOPPED</scannerStatus>
                        </value>
                    </entry>
                    <entry>
                        <key>PROCESS</key>
                        <value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                            <runtimeStrategy>SINGLETON</runtimeStrategy>
                            <mergeMode>MERGE_COLLECTIONS</mergeMode>
                        </value>
                    </entry>
                </configs>
                <status>STARTED</status>
            </container-specs>
            <configs/>
            <server-instances>
                <server-instance-id>local-server-123@localhost:8080</server-instance-id>
                <server-name>local-server-123@localhost:8080</server-name>
                <server-template-id>local-server-123</server-template-id>
                <server-url>http://localhost:8080/kie-server/services/rest/server</server-url>
            </server-instances>
            <capabilities>RULE</capabilities>
            <capabilities>PROCESS</capabilities>
            <capabilities>PLANNING</capabilities>
        </server-template>
    </server-template-list>

    [GET] /management/servers/ID

    Returns an Intelligent Process Server template.

    Server Response

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <server-template-list>
        <server-template>
            <server-id>local-server-123</server-id>
            <server-name>local-server-123</server-name>
            <container-specs>
                <container-id>hr</container-id>
                <container-name>hr</container-name>
                <server-template-key>
                    <server-id>local-server-123</server-id>
                    <server-name>local-server-123</server-name>
                </server-template-key>
                <release-id>
                    <artifact-id>EmailProject</artifact-id>
                    <group-id>org.redhat.gss</group-id>
                    <version>1.0</version>
                </release-id>
                <configs>
                    <entry>
                        <key>RULE</key>
                        <value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                            <pollInterval>500</pollInterval>
                            <scannerStatus>STOPPED</scannerStatus>
                        </value>
                    </entry>
                    <entry>
                        <key>PROCESS</key>
                        <value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                            <runtimeStrategy>SINGLETON</runtimeStrategy>
                            <mergeMode>MERGE_COLLECTIONS</mergeMode>
                        </value>
                    </entry>
                </configs>
                <status>STARTED</status>
            </container-specs>
            <configs/>
            <server-instances>
                <server-instance-id>local-server-123@localhost:8080</server-instance-id>
                <server-name>local-server-123@localhost:8080</server-name>
                <server-template-id>local-server-123</server-template-id>
                <server-url>http://localhost:8080/kie-server/services/rest/server</server-url>
            </server-instances>
            <capabilities>RULE</capabilities>
            <capabilities>PROCESS</capabilities>
            <capabilities>PLANNING</capabilities>
        </server-template>
    </server-template-list>

    [PUT] /management/servers/ID

    Creates a new Intelligent Process Server template with the specified id.

    Example Request to Create a New Intelligent Process Server Instance

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <server-template-details>
        <server-id>test-demo</server-id>
        <server-name>test-demo</server-name>
        <configs/>
        <capabilities>RULE</capabilities>
        <capabilities>PROCESS</capabilities>
        <capabilities>PLANNING</capabilities>
    </server-template-details>

    [DELETE] /management/servers/ID
    Deletes an Intelligent Process Server template with the specified id.
    [GET] /management/servers/ID/containers

    Returns all containers on given server.

    Server Response

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <container-spec-list>
        <container-spec>
            <container-id>hr</container-id>
            <container-name>hr</container-name>
            <server-template-key>
                <server-id>local-server-123</server-id>
                <server-name>local-server-123</server-name>
            </server-template-key>
            <release-id>
                <artifact-id>EmailProject</artifact-id>
                <group-id>org.redhat.gss</group-id>
                <version>1.0</version>
            </release-id>
            <configs>
                <entry>
                    <key>RULE</key>
                    <value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <pollInterval>500</pollInterval>
                        <scannerStatus>STOPPED</scannerStatus>
                    </value>
                </entry>
                <entry>
                    <key>PROCESS</key>
                    <value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                        <runtimeStrategy>SINGLETON</runtimeStrategy>
                        <mergeMode>MERGE_COLLECTIONS</mergeMode>
                    </value>
                </entry>
            </configs>
            <status>STARTED</status>
        </container-spec>
    </container-spec-list>

    [GET] /management/servers/ID/containers/CONTAINER_ID

    Returns the container information including its release id and configuration.

    Server Response

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <container-spec-details>
        <container-id>hr</container-id>
        <container-name>hr</container-name>
        <server-template-key>
            <server-id>local-server-123</server-id>
            <server-name>local-server-123</server-name>
        </server-template-key>
        <release-id>
            <artifact-id>EmailProject</artifact-id>
            <group-id>org.redhat.gss</group-id>
            <version>1.0</version>
        </release-id>
        <configs>
            <entry>
                <key>RULE</key>
                <value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <pollInterval>500</pollInterval>
                    <scannerStatus>STOPPED</scannerStatus>
                </value>
            </entry>
            <entry>
                <key>PROCESS</key>
                <value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <runtimeStrategy>SINGLETON</runtimeStrategy>
                    <mergeMode>MERGE_COLLECTIONS</mergeMode>
                </value>
            </entry>
        </configs>
        <status>STARTED</status>
    </container-spec-details>

    [PUT] /management/servers/ID/containers/CONTAINER_ID

    Creates a new container with the specified container ID, release ID, and the following configuration:

    • Runtime strategy: SINGLETON.
    • KIE Base: default.
    • KIE Session: default.
    • Deployment descriptor merge mode: MERGE_COLLECTIONS.
    • KIE Scanner: Stopped.

    Server Request

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <container-spec-details>
        <container-id>hr</container-id>
        <container-name>hr</container-name>
        <server-template-key xsi:type="serverTemplate" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <server-id>demo</server-id>
            <server-name>local-server-123</server-name>
            <configs/>
            <server-instances>
                <server-instance-id>local-server-123@localhost:8080</server-instance-id>
                <server-name>local-server-123@localhost:8080</server-name>
                <server-template-id>local-server-123</server-template-id>
                <server-url>http://localhost:8080/kie-server/services/rest/server</server-url>
            </server-instances>
        </server-template-key>
        <release-id>
            <artifact-id>HR</artifact-id>
            <group-id>org.jbpm</group-id>
            <version>1.0</version>
        </release-id>
        <configs>
            <entry>
                <key>PROCESS</key>
                <value xsi:type="processConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <runtimeStrategy>SINGLETON</runtimeStrategy>
                    <kbase></kbase>
                    <ksession></ksession>
                    <mergeMode>MERGE_COLLECTIONS</mergeMode>
                </value>
            </entry>
            <entry>
                <key>RULE</key>
                <value xsi:type="ruleConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <scannerStatus>STOPPED</scannerStatus>
                </value>
            </entry>
        </configs>
        <status>STARTED</status>
    </container-spec-details>

    [POST] /management/servers/ID/containers/CONTAINER_ID/config/CAPABILITY

    Updates the capability (RULE, PROCESS, or PLANNING, case sensitive) for a specified KIE container. Also requires a map containing the configurations for the specified KIE container capability, such as the following configurations:

    • Runtime strategy: SINGLETON.
    • KIE Base: default.
    • KIE Session: default.
    • Deployment descriptor merge mode: MERGE_COLLECTIONS.

    POST Endpoint with Parameters

    http://localhost:8080/business-central/rest/controller/management/servers/default-kieserver/containers/employeerostering_1.0.0-SNAPSHOT/config/PROCESS

    Server Request

    <process-config>
      <runtimeStrategy>SINGLETON</runtimeStrategy>
      <kbase></kbase>
      <ksession></ksession>
      <mergeMode>MERGE_COLLECTIONS</mergeMode>
    </process-config>

    [DELETE] /management/servers/ID/containers/CONTAINER_ID
    Disposes a container with the specified CONTAINER_ID.
    [POST] /management/servers/ID/containers/CONTAINER_ID/status/started
    Starts the container. No request body required.
    [POST] /management/servers/ID/containers/CONTAINER_ID/status/stopped
    Stops the Container. No request body required.

17.2. Unmanaged Intelligent Process Server Environment

The unmanaged Intelligent Process Server supports endpoints described in this section through the REST API. Note that:

  • The base URL for these remains as the endpoint defined earlier: http://SERVER:PORT/kie-server/services/rest/server/.
  • All requests require basic HTTP authentication for the kie-server role.

For information about how to access the endpoints, see Chapter 16, The REST API for Intelligent Process Server Execution.

The commands are as follows:

[GET] /

Returns the execution server information.

Server Response

<response type="SUCCESS" msg="Kie Server info">
 <kie-server-info>
  <capabilities>KieServer</capabilities>
  <capabilities>BRM</capabilities>
  <capabilities>BPM</capabilities>
  <capabilities>BPM-UI</capabilities>
  <capabilities>BRP</capabilities>
  <location>
   http://localhost:8230/kie-server/services/rest/server
  </location>
  <messages>
   <content>
    Server KieServerInfo{serverId='15ad5bfa-7532-3eea-940a-abbbbc89f1e8', version='6.5.0.Final-redhat-2', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Tue Apr 18 08:00:45 CEST 2017
   </content>
   <severity>INFO</severity>
   <timestamp>2017-04-18T08:00:45.953+02:00</timestamp>
  </messages>
  <name>KieServer@/kie-server</name>
  <id>15ad5bfa-7532-3eea-940a-abbbbc89f1e8</id>
  <version>6.5.0.Final-redhat-2</version>
 </kie-server-info>
</response>

Note that the <capabilities> tags provide information about your execution server:

  • KieServer: This is the execution server core functionality. It is always present because it provides deployment capabilities, such as deploy and undeploy containers on your server instance.
  • BRM: Rule execution capability. Corresponds to Red Hat JBoss BRMS.
  • BPM: Process, task, and job execution capability. Corresponds to Red Hat JBoss BPM Suite.
  • BPM-UI: The UI extension functionality. See Chapter 18, Intelligent Process Server UI Extension for further information.
  • BRP: The Business Resource Planner functionality.
[GET] /state

Returns information about the current state and configurations of the execution server.

Server Response

<response type="SUCCESS" msg="Successfully loaded server state for server id default-kieserver">
  <result>
    <kie-server-state-info>
      <controller>http://localhost:8080/business-central/rest/controller</controller>
      <config>
        <config-items>
          <itemName>org.kie.server.location</itemName>
          <itemValue>http://localhost:8080/kie-server/services/rest/server</itemValue>
          <itemType>java.lang.String</itemType>
        </config-items>
        <config-items>
          <itemName>org.kie.server.controller.user</itemName>
          <itemValue>controllerUser</itemValue>
          <itemType>java.lang.String</itemType>
        </config-items>
        <config-items>
          <itemName>org.kie.server.controller</itemName>
          <itemValue>http://localhost:8080/business-central/rest/controller</itemValue>
          <itemType>java.lang.String</itemType>
        </config-items>
      </config>
      <containers>
        <container-id>employee-rostering</container-id>
        <release-id>
          <group-id>employeerostering</group-id>
          <artifact-id>employeerostering</artifact-id>
          <version>1.0.0-SNAPSHOT</version>
        </release-id>
        <resolved-release-id/>
        <status>STARTED</status>
        <scanner>
          <status>STOPPED</status>
          <poll-interval/>
        </scanner>
        <config-items>
          <itemName>KBase</itemName>
          <itemValue>
          </itemValue>
          <itemType>BPM</itemType>
        </config-items>
        <config-items>
          <itemName>KSession</itemName>
          <itemValue>
          </itemValue>
          <itemType>BPM</itemType>
        </config-items>
        <config-items>
          <itemName>MergeMode</itemName>
          <itemValue>MERGE_COLLECTIONS</itemValue>
          <itemType>BPM</itemType>
        </config-items>
        <config-items>
          <itemName>RuntimeStrategy</itemName>
          <itemValue>SINGLETON</itemValue>
          <itemType>BPM</itemType>
        </config-items>
        <messages/>
        <container-alias>employeerostering</container-alias>
      </containers>
    </kie-server-state-info>
  </result>
</response>

[POST] /config

Use this endpoint to execute commands on the execution server, for example create-container, list-containers, dispose-container, and call-container.

An example call for the JAXB marshaller:

curl -X POST  -u 'kiesu:kiesu123!' -H 'Content-type: application/xml' -H 'X-KIE-ContentType: JAXB' --data @request.xml 'http://localhost:8080/kie-server/services/rest/server/config'

An example call for the XSTREAM marshaller:

curl -X POST  -u 'kiesu:kiesu123!' -H 'Content-type: application/xml' -H 'X-KIE-ContentType: XSTREAM' --data @request.xml 'http://localhost:8080/kie-server/services/rest/server/config'

An example call for the JSON marshaller:

curl -X POST  -u 'kiesu:kiesu123!' -H 'Content-type: application/json' -H 'X-KIE-ContentType: JSON' --data @request.json 'http://localhost:8080/kie-server/services/rest/server/config'

Supported commands are:

  • GetServerInfoCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <get-server-info/>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <get-server-info/>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "get-server-info" : { }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Kie Server info">
            <kie-server-info>
                <capabilities>KieServer</capabilities>
                <capabilities>BRM</capabilities>
                <capabilities>BPM</capabilities>
                <capabilities>BPM-UI</capabilities>
                <capabilities>BRP</capabilities>
                <location>http://localhost:8230/kie-server/services/rest/server</location>
                <messages>
                    <content>Server KieServerInfo{serverId='15ad5bfa-7532-3eea-940a-abbbbc89f1e8', version='6.5.0.Final-redhat-2', location='http://localhost:8230/kie-server/services/rest/server'}started successfully at Fri Mar 31 14:14:52 CEST 2017</content>
                    <severity>INFO</severity>
                    <timestamp>2017-03-31T14:14:52.710+02:00</timestamp>
                </messages>
                <name>KieServer@/kie-server</name>
                <id>15ad5bfa-7532-3eea-940a-abbbbc89f1e8</id>
                <version>6.5.0.Final-redhat-2</version>
            </kie-server-info>
        </response>
    </responses>
  • CreateContainerCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
    <create-container>
      <container container-id="command-script-container">
        <release-id>
          <artifact-id>evaluation</artifact-id>
          <group-id>org.jbpm</group-id>
          <version>1.0</version>
        </release-id>
      </container>
    </create-container>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <create-container>
          <kie-container>
            <container-id>command-script-container</container-id>
            <release-id>
              <group-id>org.jbpm</group-id>
              <artifact-id>evaluation</artifact-id>
              <version>1.0</version>
            </release-id>
          </kie-container>
        </create-container>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "create-container" : {
          "container" : {
            "status" : null,
            "messages" : [ ],
            "container-id" : "command-script-container",
            "release-id" : {
              "version" : "1.0",
              "group-id" : "org.jbpm",
              "artifact-id" : "evaluation"
            },
            "config-items" : [ ]
          }
        }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Container command-script-container successfully deployed with module org.jbpm:evaluation:1.0.">
            <kie-container container-id="command-script-container" status="STARTED">
                <release-id>
                    <artifact-id>evaluation</artifact-id>
                    <group-id>org.jbpm</group-id>
                    <version>1.0</version>
                </release-id>
                <resolved-release-id>
                    <artifact-id>evaluation</artifact-id>
                    <group-id>org.jbpm</group-id>
                    <version>1.0</version>
                </resolved-release-id>
                <scanner status="DISPOSED"/>
            </kie-container>
        </response>
    </responses>
  • GetContainerInfoCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <get-container-info container-id="command-script-container"/>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <get-container-info>
          <container-id>command-script-container</container-id>
        </get-container-info>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "get-container-info" : {
          "container-id" : "command-script-container"
        }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Info for container command-script-container">
            <kie-container container-id="command-script-container" status="STARTED">
                <messages>
                    <content>Container command-script-container successfully created with module org.jbpm:evaluation:1.0.</content>
                    <severity>INFO</severity>
                    <timestamp>2017-03-31T15:29:21.056+02:00</timestamp>
                </messages>
                <release-id>
                    <artifact-id>evaluation</artifact-id>
                    <group-id>org.jbpm</group-id>
                    <version>1.0</version>
                </release-id>
                <resolved-release-id>
                    <artifact-id>evaluation</artifact-id>
                    <group-id>org.jbpm</group-id>
                    <version>1.0</version>
                </resolved-release-id>
                <scanner status="DISPOSED"/>
            </kie-container>
        </response>
    </responses>
  • ListContainersCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <list-containers>
            <kie-container-filter>
                <release-id-filter/>
                <container-status-filter>
                    <accepted-status>CREATING</accepted-status>
                    <accepted-status>STARTED</accepted-status>
                    <accepted-status>FAILED</accepted-status>
                    <accepted-status>DISPOSING</accepted-status>
                    <accepted-status>STOPPED</accepted-status>
                </container-status-filter>
            </kie-container-filter>
        </list-containers>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
     <commands>
      <list-containers>
       <kie-container-filter>
        <release-id-filter/>
        <container-status-filter>
         <accepted-status>
           <org.kie.server.api.model.KieContainerStatus>CREATING</org.kie.server.api.model.KieContainerStatus>
           <org.kie.server.api.model.KieContainerStatus>STARTED</org.kie.server.api.model.KieContainerStatus>
           <org.kie.server.api.model.KieContainerStatus>FAILED</org.kie.server.api.model.KieContainerStatus>
           <org.kie.server.api.model.KieContainerStatus>DISPOSING</org.kie.server.api.model.KieContainerStatus>
           <org.kie.server.api.model.KieContainerStatus>STOPPED</org.kie.server.api.model.KieContainerStatus>
         </accepted-status>
        </container-status-filter>
       </kie-container-filter>
      </list-containers>
     </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "list-containers" : {
          "kie-container-filter" : {
            "release-id-filter" : { },
            "container-status-filter" : {
              "accepted-status" : [ "CREATING", "STARTED", "FAILED", "DISPOSING", "STOPPED" ]
            }
          }
        }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="List of created containers">
            <kie-containers>
                <kie-container container-id="command-script-container" status="STARTED">
                    <messages>
                        <content>Container command-script-container successfully created with module org.jbpm:evaluation:1.0.</content>
                        <severity>INFO</severity>
                        <timestamp>2017-04-10T10:05:22.866+02:00</timestamp>
                    </messages>
                    <release-id>
                        <artifact-id>evaluation</artifact-id>
                        <group-id>org.jbpm</group-id>
                        <version>1.0</version>
                    </release-id>
                    <resolved-release-id>
                        <artifact-id>evaluation</artifact-id>
                        <group-id>org.jbpm</group-id>
                        <version>1.0</version>
                    </resolved-release-id>
                    <scanner status="DISPOSED"/>
                </kie-container>
            </kie-containers>
        </response>
    </responses>
  • DisposeContainerCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <dispose-container container-id="mycontainer"/>
    </script

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <dispose-container>
          <container-id>mycontainer</container-id>
        </dispose-container>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "dispose-container" : {
          "container-id" : "mycontainer"
        }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Container mycontainer successfully disposed."/>
    </responses>
  • GetScannerInfoCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <get-scanner-info container-id="command-script-container"/>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <get-scanner-info>
          <container-id>command-script-container</container-id>
        </get-scanner-info>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "get-scanner-info" : {
          "container-id" : "command-script-container"
        }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Scanner info successfully retrieved">
            <kie-scanner status="DISPOSED"/>
        </response>
    </responses>
  • UpdateScannerCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <update-scanner container-id="command-script-container">
            <scanner poll-interval="10000" status="STARTED"/>
        </update-scanner>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <update-scanner>
          <container-id>command-script-container</container-id>
          <scanner>
            <status>STARTED</status>
            <poll-interval>10000</poll-interval>
          </scanner>
        </update-scanner>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "update-scanner" : {
          "scanner" : {
            "status" : "STARTED",
            "poll-interval" : 10000
          },
          "container-id" : "command-script-container"
        }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Kie scanner successfully created.">
            <kie-scanner poll-interval="10000" status="STARTED"/>
        </response>
    </responses>
  • UpdateReleaseIdCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <update-release-id container-id="command-script-container">
            <releaseId>
                <artifact-id>evaluation</artifact-id>
                <group-id>org.jbpm</group-id>
                <version>1.1</version>
            </releaseId>
        </update-release-id>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <update-release-id>
          <container-id>command-script-container</container-id>
          <release-id>
            <group-id>org.jbpm</group-id>
            <artifact-id>evaluation</artifact-id>
            <version>1.1</version>
          </release-id>
        </update-release-id>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "update-release-id" : {
          "releaseId" : {
            "version" : "1.1",
            "group-id" : "org.jbpm",
            "artifact-id" : "evaluation"
          },
          "container-id" : "command-script-container"
        }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Release id successfully updated.">
            <release-id>
                <artifact-id>evaluation</artifact-id>
                <group-id>org.jbpm</group-id>
                <version>1.1</version>
            </release-id>
        </response>
    </responses>
  • CallContainerCommand

    The CallContainerCommand command requires the payload attribute. The following payload is used in the examples:

    import org.kie.server.api.marshalling.Marshaller;
    import org.kie.server.api.marshalling.MarshallerFactory;
    import org.kie.server.api.marshalling.MarshallingFormat;
    
    ...
    
    Marshaller marshaller = MarshallerFactory.getMarshaller(MarshallingFormat.JSON,myclass.class.getClassLoader());
    //Marshalling format is changed based on the method of marshalling for the CallContainerCommand. Also note myclass.class classloader is called. If replicating this code, change the name to the name of your class.
    
    Command<?> fire = KieServices.Factory.get().getCommands().newFireAllRules();
    BatchExecutionCommand batch = KieServices.Factory.get().getCommands().newBatchExecution(Arrays.<Command<?>>asList(fire), "defaultKieSession");
    String payload = marshaller.marshall(batch);

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <call-container container-id="command-script-container">
            <payload>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
    &lt;batch-execution lookup="defaultKieSession"&gt;
        &lt;fire-all-rules max="-1"/&gt;
    &lt;/batch-execution&gt;
    </payload>
        </call-container>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <call-container>
          <container-id>command-script-container</container-id>
          <payload>&lt;batch-execution lookup=&quot;defaultKieSession&quot;&gt;
      &lt;fire-all-rules/&gt;
    &lt;/batch-execution&gt;</payload>
        </call-container>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "call-container" : {
          "payload" : "{\n  \"lookup\" : \"defaultKieSession\",\n  \"commands\" : [ {\n    \"fire-all-rules\" : {\n      \"max\" : -1,\n      \"out-identifier\" : null\n    }\n  } ]\n}",
          "container-id" : "command-script-container"
        }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Container command-script-container successfully called.">
            <results>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
    &lt;execution-results&gt;
        &lt;results/&gt;
        &lt;facts/&gt;
    &lt;/execution-results&gt;
    </results>
        </response>
    </responses>
  • GetServerStateCommand

    XML body request using the JAXB marshaller:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
        <get-server-state/>
    </script>

    XML body request using the XSTREAM marshaller:

    <script>
      <commands>
        <org.kie.server.api.commands.GetServerStateCommand/>
      </commands>
    </script>

    JSON body request:

    {
      "commands" : [ {
        "get-server-state" : { }
      } ]
    }

    An example response:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <responses>
        <response type="SUCCESS" msg="Successfully loaded server state for server id 15ad5bfa-7532-3eea-940a-abbbbc89f1e8">
            <kie-server-state-info>
                <config>
                    <config-items>
                        <itemName>org.kie.server.repo</itemName>
                        <itemValue>/BPMS6.4/standalone/data</itemValue>
                        <itemType>java.lang.String</itemType>
                    </config-items>
                </config>
                <containers container-id="command-script-container" status="STARTED">
                    <release-id>
                        <artifact-id>evaluation</artifact-id>
                        <group-id>org.jbpm</group-id>
                        <version>1.1</version>
                    </release-id>
                    <resolved-release-id>
                        <artifact-id>evaluation</artifact-id>
                        <group-id>org.jbpm</group-id>
                        <version>1.1</version>
                    </resolved-release-id>
                    <scanner poll-interval="1000" status="STARTED"/>
                </containers>
            </kie-server-state-info>
        </response>
    </responses>

    The following example request contains the create-container, call-container, and dispose-container commands:

    Sample Request to Create a Container

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <script>
      <create-container>
        <container container-id="command-script-container">
          <release-id>
            <artifact-id>baz</artifact-id>
            <group-id>foo.bar</group-id>
            <version>2.1.0.GA</version>
          </release-id>
        </container>
      </create-container>
      <call-container container-id="command-script-container">
        <payload><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
          <batch-execution lookup="defaultKieSession">
            <insert out-identifier="message" return-object="true" entry-point="DEFAULT" disconnected="false">
              <object xsi:type="message" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <text>HelloWorld</text>
              </object>
            </insert>
            <fire-all-rules max="-1"/>
          </batch-execution>
        </payload>
      </call-container>
      <dispose-container container-id="command-script-container"/>
    </script>

[GET] /containers

Returns a list of containers on the server.

Server Response

<response type="SUCCESS" msg="List of created containers">
  <kie-containers>
    <kie-container container-id="MyProjectContainer" status="STARTED">
      <release-id>
        <artifact-id>Project1</artifact-id>
        <group-id>com.redhat</group-id>
        <version>1.0</version>
      </release-id>
      <resolved-release-id>
        <artifact-id>Project1</artifact-id>
        <group-id>com.redhat</group-id>
        <version>1.0</version>
      </resolved-release-id>
    </kie-container>
  </kie-containers>
</response>

Starting with Red Hat JBoss BPM Suite version 6.4, you can filter the containers by adding any of the following Maven artifact coordinates to the query:

  • groupId
  • artifactId
  • version

Example 17.1. Filtering Containers by Maven Properties

Issuing the following call lists containers with Group ID org.example, Artifact ID artifact, and version 1.0.0.Final:

curl -u 'kieserver:kieserver1!' -H 'Accept: application/json' 'http://localhost:8080/kie-server/services/rest/server/containers?groupId=org.example&artifactId=artifact&version=1.0.0.Final'

To filter by container status, specify the status attribute. Multiple values are separated with a comma.

Example 17.2. Example Filtering Containers by Status

Issuing the following call lists only failed and stopped containers:

curl -u 'kieserver:kieserver1!' -H 'Accept: application/json' 'http://localhost:8080/kie-server/services/rest/server/containers?status=FAILED,STOPPED'
⁠[GET] /containers/ID

Returns the status and information about a specified container.

Server Response

⁠<response type="SUCCESS" msg="Info for container MyProjectContainer">
  <kie-container container-id="MyProjectContainer" status="STARTED">
    <release-id>
      <artifact-id>Project1</artifact-id>
      <group-id>com.redhat</group-id>
      <version>1.0</version>
    </release-id>
    <resolved-release-id>
      <artifact-id>Project1</artifact-id>
      <group-id>com.redhat</group-id>
      <version>1.0</version>
    </resolved-release-id>
  </kie-container>
</response>

[PUT] /containers/CONTAINER_ID

Creates a new container in the Intelligent Process Server with a container ID specified in the URI and configuration specified in the request body. The configuration, in addition to the project release ID, provides the following settings:

  • Runtime strategy: SINGLETON.
  • KIE Base: default.
  • KIE Session: default.
  • Deployment descriptor merge mode: MERGE_COLLECTIONS.
  • KIE Scanner:

    • Status: STARTED.
    • Interval: 5000.

Request to Create a Container

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<kie-container>
    <config-items>
        <itemName>RuntimeStrategy</itemName>
        <itemValue>SINGLETON</itemValue>
        <itemType>java.lang.String</itemType>
    </config-items>
    <config-items>
        <itemName>MergeMode</itemName>
        <itemValue>MERGE_COLLECTIONS</itemValue>
        <itemType>java.lang.String</itemType>
    </config-items>
    <config-items>
        <itemName>KBase</itemName>
        <itemValue></itemValue>
        <itemType>java.lang.String</itemType>
    </config-items>
    <config-items>
        <itemName>KSession</itemName>
        <itemValue></itemValue>
        <itemType>java.lang.String</itemType>
    </config-items>
    <release-id>
        <artifact-id>EmailProject</artifact-id>
        <group-id>org.redhat.gss</group-id>
        <version>1.0</version>
    </release-id>
    <scanner poll-interval="5000" status="STARTED"/>
</kie-container>

Example Server Response When Creating a Container

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response type="SUCCESS" msg="Container Example successfully deployed with module org.redhat.gss:EmailProject:1.0.">
    <kie-container container-id="Example" status="STARTED">
        <config-items>
            <itemName>RuntimeStrategy</itemName>
            <itemValue>SINGLETON</itemValue>
            <itemType>java.lang.String</itemType>
        </config-items>
        <config-items>
            <itemName>MergeMode</itemName>
            <itemValue>MERGE_COLLECTIONS</itemValue>
            <itemType>java.lang.String</itemType>
        </config-items>
        <config-items>
            <itemName>KBase</itemName>
            <itemValue></itemValue>
            <itemType>java.lang.String</itemType>
        </config-items>
        <config-items>
            <itemName>KSession</itemName>
            <itemValue></itemValue>
            <itemType>java.lang.String</itemType>
        </config-items>
        <release-id>
            <artifact-id>EmailProject</artifact-id>
            <group-id>org.redhat.gss</group-id>
            <version>1.0</version>
        </release-id>
        <resolved-release-id>
            <artifact-id>EmailProject</artifact-id>
            <group-id>org.redhat.gss</group-id>
            <version>1.0</version>
        </resolved-release-id>
        <scanner poll-interval="5000" status="STARTED"/>
    </kie-container>
</response>

[DELETE] /containers/ID

⁠Disposes of a container specified by the ID.

Server Response Disposing a Container

<response type="SUCCESS" msg="Container MyProjectContainer successfully disposed."/>

[GET] /containers/ID/release-id

Returns a full release ID for a specified container.

Server Response

⁠<response type="SUCCESS" msg="ReleaseId for container MyProjectContainer">
  <release-id>
    <artifact-id>Project1</artifact-id>
    <group-id>com.redhat</group-id>
    <version>1.0</version>
  </release-id>
</response>

[POST] /containers/ID/release-id

Allows you to update the release ID of a container.

Sample Server Request

<release-id>
  <artifact-id>Project1</artifact-id>
  <group-id>com.redhat</group-id>
  <version>1.1</version>
</release-id>

The server responds with a success or error message, such as:⁠

Sample Server Response

<response type="SUCCESS" msg="Release id successfully updated.">
  <release-id>
    <artifact-id>Project1</artifact-id>
    <group-id>com.redhat</group-id>
    <version>1.0</version>
  </release-id>
</response>

[GET] /containers/ID/scanner

Returns information about the scanner for container’s automatic updates.

Server Response

<response type="SUCCESS" msg="Scanner info successfully retrieved">
  <kie-scanner status="DISPOSED"/>
</response>

[POST] /containers/ID/scanner

Allows you to start or stop a scanner that controls polling for updated container deployments.

Example Server Request to Start the Scanner

<kie-scanner status="STARTED" poll-interval="20"/>

Server Response

<response type="SUCCESS" msg="Kie scanner successfully created.">
  <kie-scanner status="STARTED"/>
</response>

To stop the scanner, replace the status with DISPOSED and remove the poll-interval attribute.