Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Business Process Management Initiative (BPMI) has developed a standard Business Process Modelling Notation (BPMN). The BPMN 2.0 specification was released to the public in January 2011. BPMN is integrated with WSO2 BPS using the Activiti engine 5.19.0, which is a light-weight workflow and Business Process Management (BPM) platform targeted at business people, developers, and system admins. It is open source and distributed under the Apache license. Activiti runs in any Java application, on a server, on a cluster or in the cloud. It is extremely lightweight and based on simple concepts.

...

Process definitions are an object structure representing an executable process composed of activities and transitions. Business processes are often created with graphical editors that store the process definition in a certain file format. These files can be added to a deployment artifact, such as , a Business Archive (.bar) file. At the time of deployment, the engine will then parse the process definition files to an executable instance of this class, that can be used to start a ProcessInstance.

Anchor
ListProcessDefinitions
ListProcessDefinitions
 

List of Process Definitions
Request TypeGET
Request URLhttps://<Host Name>:<Port>/bpmn/repository/process-definitions
Sample URLhttps://localhost:9443/bpmn/repository/process-definitions
Details

This request will display all the process definitions in the server.

Note

Note: You can use this request when you need to find a processDefinitionID or processDefinitionKey to be sent with a request. In the response body below, 'id' is the processDefinitionId and 'key' is the processDefinitionKey.

Success Response Body
Code Block
languagejava
{
  "data": [
    {
      "id": "sampleJavaServiceTask:1:27503",
      "url": "https:\/\/localhost:9443\/bpmn\/repository\/process-definitions\/sampleJavaServiceTask%3A1%3A27503",
      "key": "sampleJavaServiceTask",
      "version": 1,
      "name": null,
      "description": null,
      "deploymentId": "27501",
      "deploymentUrl": "https:\/\/localhost:9443\/bpmn\/repository\/deployments\/27501",
      "resource": "https:\/\/localhost:9443\/bpmn\/repository\/deployments\/27501\/resources\/sampleJavaServiceTask.bpmn20.xml",
      "diagramResource": null,
      "category": "https:\/\/www.bpmnwithactiviti.org",
      "graphicalNotationDefined": false,
      "suspended": false,
      "startFormDefined": false
    }
  ],
  "total": 1,
  "start": 0,
  "sort": "name",
  "order": "asc",
  "size": 1
}
Note

Note: Use this request above, when you need to find a process definition id or processDefinitionKey to be sent with a request. 'id' in the response body is the processDefinitionId and 'key' is the processDefinitionKey.

Get a Process Definition
Request TypeGET
Request URLhttps://<Host Name>:<Port>/bpmn/repository/process-definitions/{processDefinitionId}
Sample URL

https://localhost:9443/bpmn/repository/process-definitions/sampleJavaServiceTask:1:27503

Details

This request is used to get a process definition uniquely using the process definition Id.

Success Response Body
Code Block
languagejava
{
      "id": "sampleJavaServiceTask:1:27503",
      "url": "https:\/\/localhost:9443\/bpmn\/repository\/process-definitions\/sampleJavaServiceTask%3A1%3A27503",
      "key": "sampleJavaServiceTask",
      "version": 1,
      "name": null,
      "description": null,
      "deploymentId": "27501",
      "deploymentUrl": "https:\/\/localhost:9443\/bpmn\/repository\/deployments\/27501",
      "resource": "https:\/\/localhost:9443\/bpmn\/repository\/deployments\/27501\/resources\/sampleJavaServiceTask.bpmn20.xml",
      "diagramResource": null,
      "category": "https:\/\/www.bpmnwithactiviti.org",
      "graphicalNotationDefined": false,
      "suspended": false,
      "startFormDefined": false
 }

...

List of Process Instances
Request TypeGET
Request URLhttps://<Host Name>:<Port>/bpmn/runtime/process-instances
Sample URLhttps://localhost:9443/bpmn/runtime/process-instances
Details

This request retrieves all the process instances in of the server.

Success Response Body
Code Block
languagejava
 "data": [
    {
      "id": "27504",
      "url": "https:\/\/localhost:9443\/bpmn\/runtime\/process-instances\/27504",
      "businessKey": null,
      "suspended": false,
      "ended": false,
      "processDefinitionId": "sampleJavaServiceTask:1:27503",
      "processDefinitionUrl": "https:\/\/localhost:9443\/bpmn\/repository\/process-definitions\/sampleJavaServiceTask%3A1%3A27503",
      "activityId": "waitState",
      "variables": [
        
      ],
      "tenantId": "",
      "completed": false
    }
  ],
  "total": 1,
  "start": 0,
  "sort": "id",
  "order": "asc",
  "size": 1
}

...

Start a Process Instance
Request TypePOST
Request URLhttps://<Host Name>:<Port>/bpmn/runtime/process-instances
Details

This request is used to start a process instance. The process instance can be started using the process definition id or process definition key or message. Only one of processDefinitionId, processDefinitionKey or message can be used in the request body. Parameters businessKey, variables and tenantId are optional.

Note

Note: It is not necessary to send in all the variables to start the process instance, sending a request body with only the processDefinitionId, processDefinitionKey or message should suffice. When sending a request body with the processDefinitionKey or message, providing the tenantId is mandatory.

It is not recommend recommended to start a process instance using a message as it might not be able to uniquely identify a process instance.

Request Body

Request body (start by process definition Id):

Code Block
languagejava
{
   "processDefinitionId":"sampleJavaServiceTask:1:27503",
   "businessKey":"myBusinessKey",
   "variables": [
      {
        "name":"myVar",
        "value":"This is a variable"
      }
   ]
}

Request body (start by process definition key):

Code Block
languagejava
{
   "processDefinitionKey":"sampleJavaServiceTask",
   "businessKey":"myBusinessKey",
   "tenantId": "tenant1",
   "variables": [
      {
        "name":"myVar",
        "value":"This is a variable"
      }
   ]
}

Request body (start by message):

Code Block
languagejava
{
   "message":"newOrderMessage",
   "businessKey":"myBusinessKey",
   "tenantId": "tenant1",
   "variables": [
      {
        "name":"myVar",
        "value":"This is a variable"
      }
   ]
}
Activate or Suspend a Process Instance
Request TypePUT
Request URLhttps://<Host Name>:<Port>/bpmn/runtime/process-instances/{proccessInstanceId}
Details

This request is used to activate a suspended process instance or vice versa.

Send a PUT request with the given respective requestbody request body as indicated below to activate or suspend the process instance. The response body of the request will be the same.

Request Body

Request body (activate a process instance):

Code Block
languagejava
{
   "action":"activate"
}

Request body (suspend a process instance):

Code Block
languagejava
{
   "action":"suspend"
}
Query a Process Instance
Request TypePOST
Request URLhttps://<Host Name>:<Port>/bpmn/query/process-instances
Details

This request is used to query or find a specific process instance using any of the attributes of the process instance. The request body depicts how to query for a process instance using the process definition keyprocessDefinitionKey. You can also use definition Id the processDefinitionID to query for a specific process instance. 

Info

You can retrieve the processDefinitionKey or processDefinitionID using the List Process Definitions service.

Note

When querying a process instance using the process definition keyprocessDefinitionKey, providing the tenantId tenantID is mandatory.

Request Body
Code Block
languagejava
{
  "processDefinitionKey":"sampleJavaServiceTask"
}

...

List all Tasks
Request TypeGET
Request URLhttps://<Host Name>:<Port>/bpmn/runtime/tasks
Sample URLhttps://localhost:9443/bpmn/runtime/tasks
Details

This request will retrieve all the tasks in on the server.

Success Response Body
Code Block
languagejava
{
  "data": [
    {
      "assignee" : "kermit",
      "createTime" : "2015-01-17T10:17:43.902+0000",
      "delegationState" : "pending",
      "description" : "Task description",
      "dueDate" : "2015-01-17T10:17:43.902+0000",
      "execution" : "https://localhost:9443/bpmn/runtime/executions/5",
      "id" : "8",
      "name" : "My task",
      "owner" : "owner",
      "parentTask" : "https://localhost:9443/bpmn/runtime/tasks/9",
      "priority" : 50,
      "processDefinition" : "https://localhost:9443/bpmn/repository/process-definitions/bpmnTaskProcess%3A1%3A4",
      "processInstance" : "https://localhost:9443/bpmn/runtime/process-instances/5",
      "suspended" : false,
      "taskDefinitionKey" : "theTask",
      "url" : "https://localhost:9443/bpmn/runtime/tasks/8",
      "tenantId" : null
    }
  ],
  "total": 1,
  "start": 0,
  "sort": "name",
  "order": "asc",
  "size": 1
}

...