This topic applies only to the IBM Business Automation Workflow Advanced
configuration.

Counting BPEL process instances

Draft comment:
This topic only applies to BAW, and is located in the BAW repository. Last updated on 2025-03-13 12:15
You can use the Process Admin Console or a REST API call to count the number of BPEL process instances that are in an end state and that match specified criteria before you decide whether to delete them.
Important: To be able to count or delete BPEL processes, your user ID must be mapped onto the BPESystemAdministrator role. To map a user ID to the BPESystemAdministrator role, use the admin console and navigate to Applications > Application Types > WebSphere enterprise applications, then select BPEContainer_clusterName > Security role to user/group mapping, select the BPESystemAdministrator role, click Map Users..., search for the user ID, add it to the BPESystemAdministrator role, save, synchronize, and restart BPEContainer_clusterName.
Remember: If you want to specify particular process instance states, the states running, finished, and stopped correspond to the states active, completed, and failed in wsadmin and Process Inspector.

Using the Process Admin Console

  1. Click Server Admin > Workflow Admin > Health Management.
  2. Select the command Count BPEL Processes.
  3. Specify values for the command's parameters.
  4. Click Submit.
  5. If there is an error, you will see the error message.
  6. If there is no error, you see how many instances in the system match the criteria.

Using a REST API call

Call the operations REST API GET https://host:port/ops/adv/bpm/processes/count.

Remember: For IBM® BPM on Cloud, the operations REST APIs have the following URL, https://hostname.bpm.ibmcloud.com/bpm/environment/ops/adv/bpm/processes/count, where environment has the value dev for the development system, test for the test system, or run for the production (runtime) system.
The following examples illustrate how to use the API.
  • To count how many BPEL instances are in the states finished, terminated and failed:
    GET https://host:port/ops/adv/bpm/processes/count
  • To count how many BPEL instances are in the state finished that ended between 2015-07-16T12:00:00-06:00 and 2016-08-26T12:34:56-06:00, and were started by the user user7
    GET https://host:port/ops/adv/bpm/processes/count?states=finished
        &ended_after=2015-07-16T12:00:00-06:00&ended_before=2016-08-26T12:34:56-06:00
        &starter=user7
  • To count all instances that are in the states terminated and failed for the process template myTemplate which is valid from 2016-07-16T19:20:30-06:00:
    GET https://host:port/ops/adv/bpm/processes/count?states=terminated,failed
        &model=myTemplate&valid_from=2016-07-16T19:20:30-06:00
    Remember: If you need to specify a time zone that is ahead of UTC, you must encode the + symbol as %2B. For example, for the Central European Time zone +01:00, you must use %2B01:00 in your URL. Alternatively, you can specify a UTC date, for example ended_after=2016-01-01T01:00:00Z.
This allows you to check how many instances the delete BPEL process instance API call will delete if you use the same criteria.
Important: All calls to the Operations REST API require that the HTTP header BPMCSRFToken is set with every request. For information about how to obtain a token, see Preventing cross site request forgery.
Tip: For more details about the operations REST APIs and to try invoking them from a browser, use the Swagger interface. The Swagger interface is available at the URL https://server:port/ops/explorer Where server is the host name of your workflow server and port is the port number that is used by the workflow server. For example, https://localhost:9443/ops/explorer