Ask a question
Missed IBM TechXchange Dev Day: Virtual Agents? On-demand viewing is available here
The IBM Business Automation Workflow (BAW) has a new set of REST APIs that replace and extend the heritage BPD REST APIs.The new REST APIs are available for creating services for BAW workflow artifacts and are divided into 2 categories:
The Swagger definition for the REST APIs is included with Business Automation Workflow. If your Business Automation Workflow installation includes a web server that hosts the Swagger UI, you can access the Swagger (also known as OpenAPI) definition for the REST APIs from a URL with the following format:
https://<host_name>:<port_number>/ops/explorerWhere host_name is the name of your web server and port_number is the port number used by the web server.To use BAW REST APIs, we can use the following links:
https://<host_name>:<port_number>/ops/explorer
host_name
port_number
https://<host_name>:<port_number>/ops/docs
https://<host_name>:<port_number>/bpm/explorer/?url=/ops/docs
https://<host_name>:<port_number>/bpm/docs
https://<host_name>:<port_number>/bpm/explorer/?url=/bpm/docs
In this section we will illustrate the use of the BAW REST API to obtain data from an existing process instance.
First we need to get the “token”, which will be used in all other features of the REST API.
To avoid cross site request forgery attacks, BAW's REST API operations require that this token be informed in the HTTP header (BPMCSRFToken) of each request.
Accessing the IBM Business Automation Workflow Process REST Interface, we can list the operations of the “System” group and choose the “POST /system/login” operation.
POST /system/login
In the “Parameters” section, click on the “Example Value” area to copy the example to the “login_request” area.
At the bottom of the “POST /system/login” operation screen area, click “Try it out!”.
The result of executing the operation is displayed just below the “Try it out!” button:
We must then save the result displayed in the “csrf_token” field, which in this case is:
eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MzU4MDEyNTIsInN1YiI6ImFkbWluIn0.iIUKxkJNrebPrO56SxfSfikrIFpqYPIpHpjO59AlU94
Now that we have the “token”, we can run the REST API that will bring us the data from a process instance.
Accessing the IBM Business Automation Workflow Process REST Interface, we list the operations of the “Process” group and choose the “GET /processes/{process_id}” operation.
GET /processes/{process_id}
We inform the “token” obtained in the previous execution in the “BPMCSRFToken” field and in the “process_id” field, we inform an existing instance id number, in our example, we inform the instance number “280”:
And at the bottom of the operation screen area, click “Try it out!” Thus, we conclude the example of using the new BAW REST API.