cancel
Showing results for 
Search instead for 
Did you mean: 

REST API to get state of a running process in json response

activitinike
Champ in-the-making
Champ in-the-making
Hello,

I am trying to fetch state of a running process details using below REST call

https://docs.alfresco.com/activiti/docs/dev-guide/1.4.0/#_get_process_instance_details
api/enterprise/process-instances/{processInstanceId}

For e.g: I have a process, which is waiting at UserTask, so I expect response of REST call to provide this information.

It returns following response:

 
{
  "id": "40026",
  "name": "TestProcess",
  "businessKey": null,
  "processDefinitionId": "TestProcess:1:2504",
  "tenantId": "tenant_1",
  "started": "2016-05-11T19:22:22.927+0000",
  "ended": null,
  "startedBy": {
    "id": 1,
    "firstName": null,
    "lastName": "Administrator",
    "email": "a@a.com"
  },
  "processDefinitionName": "TestProcess",
  "processDefinitionDescription": "First version copy",
  "processDefinitionKey": "TestProcess",
  "processDefinitionCategory": "http://www.activiti.org/processdef",
  "processDefinitionVersion": 1,
  "processDefinitionDeploymentId": "2501",
  "graphicalNotationDefined": true,
  "startFormDefined": true,
  "variables": []
}


In this response, I don't see any field related to current state of the process.

Please guide if there are any other REST api to use to get useful information.

Thanks

3 REPLIES 3

kiranchandran_k
Champ in-the-making
Champ in-the-making
Hi,
I think you want to see the task details, right?
If so, you can use - POST api/enterprise/tasks/query with a request body like {"processDefinitionId": "TestProcess:1:2504","state":"active","processInstanceId":"40026" } and if you want to see the already completed tasks for this process, you can change the parameter 'state' from active to completed.

I hope this helps.
Thanks.

activitinike
Champ in-the-making
Champ in-the-making
Hi,

I see there is a difference between Opensource REST response and the Enterprise REST response:
api/enterprise/process-instances/{processInstanceId}

api/runtime/process-instances/{processInstanceId}

Opensource (/runtime) response contains the activityId:, but enterprise (/enterprise) version doesn't.

Its confusing to understand the difference between Opensource and Enterprise version REST API.

Thanks.

jbarrez
Star Contributor
Star Contributor
It's actually pretty easy: the OSS REST API is fully there, but it should mostly be used for people that have already built stuff on the OSS API.
Otherwise, the enterprise (under api/enterprise) is the way to go?