How to list all the tasks in camunda based on process definition key

I want to get all the ongoing and future tasks if it’s based on process instance id. Incase of definition,need to get all the tasks from camunda bpmn

@Ram_Kumar if you’re looking for static taskDefinitionKey you can parse the bpmn using Bpmn Model Api. Otherwise if you’re looking for engine generated taskId, you need to query for tasks using taskservice but this api will not return future task instances, because engine doesn’t know the token execution path before completing the current task. It applies for each task in the process definition.

Yeah got it. Now going to use definitionkey/xml rest call and parse those xml response to get all the tasks. How to do that in java to only get those tasks from xml ?

@Ram_Kumar refer this example:

Hi @aravindhrs thanks for your response. Here I’m getting response in xml format and not reading it from bpmn file directly. is there any way to parse xml to get required list of tasks?

BpmnModelInstance bpmnModelInstance = Bpmn.readModelFromStream(xml);

Instead of using xml way, found new way to get all the tasks for a particular process definition Key.

using pd = repositoryService.PDQuery.PDKey(key).singleresult();
from above value, get the PD Id. with that can get the modelInstance from same repoService.
BpmnModelInstance ins = repositoryService.getBpmnModelInstance(pd.getId());
using above ins, we can get all the tasks.

I would like to find a rest call that gives me the same information( No XML, Just plain JSON and no Instances only the Tasks defined in the Process Definition).