This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

BPMN Statistics REST API

This section provides details on the BPMN statistics REST API and the methods used to generate statistics in the BPMN-explorer. The following section provides detailed information on each method that can be used to retrieve statistics.

All methods of the REST API will be invoked after the base URL.

Base URL

Base URL: https://<hostname>:<port-name>/bpmn/stats/

Retrieving statistics about processes and tasks

Method get:/process-instances/count
DescriptionRetrieves the process count of deployed processes.
ParametersHeader Parameter - Media types acceptable for the response. the default is JSON.
Return TypeDeployed processes with their process count.
Example Data
{
 "data": [
 {
 "processDefinitionId": "helloWorldProcess:1:11",
 "deployedProcessCount": 1
 },
 {
 "processDefinitionId": "manualTaskProcess:1:15",
 "deployedProcessCount": 4
 }
 ]
}
Methodget:/process-instances/state/all/count/
DescriptionRetrieves the number of process instances with various states.
ParametersHeader Parameter - Media types acceptable for the response. the default is JSON.
Return TypeCount of process instances in each state.
States: Completed, Active, Suspended, Failed
Example Data
{
 "data": [
 {
 "count": 2,
 "statusOfProcessOrTask": "Completed"
 },
 {
 "count": 4,
 "statusOfProcessOrTask": "Active"
 },
 {
 "count": 0,
 "statusOfProcessOrTask": "Suspended"
 },
 {
 "count": 0,
 "statusOfProcessOrTask": "Failed"
 }
 ]
}
Methodget:/task-instances/status/all/count
DescriptionRetrieves the number of task instances with various states.
ParametersHeader Parameter - Media types acceptable for the response. the default is JSON.
Return Type

Count of task instances in each state.

States: Completed, Active, Suspended, Failed

Example Data
{
 "data": [
 {
 "count": 4,
 "statusOfProcessOrTask": "Completed"
 },
 {
 "count": 4,
 "statusOfProcessOrTask": "Active"
 },
 {
 "count": 0,
 "statusOfProcessOrTask": "Suspended"
 },
 {
 "count": 0,
 "statusOfProcessOrTask": "Failed"
 }
 ]
}
Methodget:/process-instances/duration/average
DescriptionRetrieves the average time duration of completed processes.
ParametersHeader Parameter - Media types acceptable for the response. The default is JSON.
Return Type

Completed processes and the average time duration for each process.

Example Data
{
 "data": [
 {
 "processDefinitionId": "helloWorldProcess:1:11",
 "averageTimeForCompletion": 0.26085
 },
 {
 "processDefinitionId": "manualTaskProcess:1:15",
 "averageTimeForCompletion": 24.555516666666666
 }
 ]
}
Methodget:/task-instances/duration/avarage/{pid}
DescriptionRetrieves the average time duration of each task in a completed process.
Parameters

pId: process Definition Id of the process (required).

Header Parameter - Media types acceptable for the response. The default is JSON.

Return Type

Completed tasks with their average time duration for each completed process.

Example Data
Request - > /task-instances/duration/avarage/manualTaskProcess:1:15
{
 "data": [
 {
 "taskDefinitionKey": "orderConfirmed",
 "averageTimeForCompletion": 722751
 },
 {
 "taskDefinitionKey": "placeOrder",
 "averageTimeForCompletion": 4117232
 },
 {
 "taskDefinitionKey": "statusOfDelivery",
 "averageTimeForCompletion": 7973
 }
 ]
}
Methodget:/task-instances/count/variation
DescriptionRetrieves the task variation over time i.e., tasks started and completed over the months.
ParametersHeader Parameter - Media types acceptable for the response. The default is JSON.
Return Type

Number of tasks started and completed over the months.

Example Data
{
 "data": [
 {
 "startedInstances": 10,
 "completedInstances": 4,
 "month": "Jan"
 },
 {
 "startedInstances": 6,
 "completedInstances": 3,
 "month": "Feb"
 },
 {
 "startedInstances": 9,
 "completedInstances": 9,
 "month": "March"
 },
 {
 "startedInstances": 2,
 "completedInstances": 4,
 "month": "April"
 },
 {
 "startedInstances": 0,
 "completedInstances": 0,
 "month": "May"
 },
 {
 "startedInstances": 11,
 "completedInstances": 7,
 "month": "June"
 },
 {
 "startedInstances": 14,
 "completedInstances": 12,
 "month": "July"
 },
 {
 "startedInstances": 4,
 "completedInstances": 3,
 "month": "Aug"
 },
 {
 "startedInstances": 2,
 "completedInstances": 1,
 "month": "Sep"
 },
 {
 "startedInstances": 2,
 "completedInstances": 2,
 "month": "Oct"
 },
 {
 "startedInstances": 0,
 "completedInstances": 0,
 "month": "Nov"
 },
 {
 "startedInstances": 10,
 "completedInstances": 7,
 "month": "Dec"
 }
 ]
}
Methodget:/process-instances/count/variation
DescriptionRetrieves the process variation over time i.e., process instances started and completed over the months.
ParametersHeader Parameter - Media types acceptable for the response. The default is JSON.
Return Type

Number of process instances started and completed over the months.

Example Data
{
 "data": [
 {
 "startedInstances": 3,
 "completedInstances": 3,
 "month": "Jan"
 },
 {
 "startedInstances": 10,
 "completedInstances": 5,
 "month": "Feb"
 },
 {
 "startedInstances": 8,
 "completedInstances": 6,
 "month": "March"
 },
 {
 "startedInstances": 3,
 "completedInstances": 2,
 "month": "April"
 },
 {
 "startedInstances": 14,
 "completedInstances": 12,
 "month": "May"
 },
 {
 "startedInstances": 20,
 "completedInstances": 12,
 "month": "June"
 },
 {
 "startedInstances": 6,
 "completedInstances": 3,
 "month": "July"
 },
 {
 "startedInstances": 0,
 "completedInstances": 0,
 "month": "Aug"
 },
 {
 "startedInstances": 6,
 "completedInstances": 1,
 "month": "Sep"
 },
 {
 "startedInstances": 9,
 "completedInstances": 7,
 "month": "Oct"
 },
 {
 "startedInstances": 11,
 "completedInstances": 10,
 "month": "Nov"
 },
 {
 "startedInstances": 6,
 "completedInstances": 3,
 "month": "Dec"
 }
 ]
}
Methodget:/processes/
DescriptionGet all the deployed processes.
ParametersHeader Parameter - Media types acceptable for the response. The default is JSON.
Return Type

Deployed processes

Example Data
{
 "data": [
 "helloWorldProcess:1:11",
 "manualTaskProcess:1:15",
 "testProcess:1:4",
 "userTaskProcess:1:10"
 ]
}

Retrieving statistics about users


Methodget:/user-performance/variation/{assignee}
DescriptionGet the task variation of each user over time i.e., tasks started and completed by each user over the months.
Parameters

assignee: user (required).

Header Parameter - Media types acceptable for the response. Default is JSON

Return Type

Number of tasks started and completed over the months by the selected user.

Example Data
{
 "data": [
 {
 "startedInstances": 3,
 "completedInstances": 4,
 "month": "Jan"
 },
 {
 "startedInstances": 10,
 "completedInstances": 8,
 "month": "Feb"
 },
 {
 "startedInstances": 6,
 "completedInstances": 5,
 "month": "March"
 },
 {
 "startedInstances": 4,
 "completedInstances": 2,
 "month": "April"
 },
 {
 "startedInstances": 9,
 "completedInstances": 10,
 "month": "May"
 },
 {
 "startedInstances": 7,
 "completedInstances": 6,
 "month": "June"
 },
 {
 "startedInstances": 5,
 "completedInstances": 2,
 "month": "July"
 },
 {
 "startedInstances": 0,
 "completedInstances": 0,
 "month": "Aug"
 },
 {
 "startedInstances": 1,
 "completedInstances": 1,
 "month": "Sep"
 },
 {
 "startedInstances": 2,
 "completedInstances": 2,
 "month": "Oct"
 },
 {
 "startedInstances": 10,
 "completedInstances": 6,
 "month": "Nov"
 },
 {
 "startedInstances": 5,
 "completedInstances": 4,
 "month": "Dec"
 }
 ]
}


Response Codes

Response CodeDescription
200- OkIndicates that the response was found and returned.
401- Unauthorized

The operation failed.

The operation requires an Authentication header to be set. If this was present in the request, the supplied credentials are not valid or the user is not authorized to perform this operation.

404- Not FoundIndicates that the requested details were not found.
405 - Method Not AllowedThe operation failed. The used method is not allowed for this resource.
415 - Unsupported Media Type

The operation failed.

The request body contains an unsupported media type. This also occurs when the request-body JSON contains an unknown attribute or value that does not have the right format/type to be accepted.

500 - Internal Server ErrorThe operation failed. An unexpected exception occurred while executing the operation. The response-body contains details about the error.