Hi All,
Honestly speaking I have been digging/searching on this forums before posting my question here but I could not find exactly what I need; I need to extract a huge amount of information for reporting purposes using the Java API (I need to create a single file with a lot of information).
Could you please tell me what’s the Java API call equivalent to the following REST-API calls? As follows:
Below is the URL which gives the process instance list:
/rest/process-instance
if you want to see particular process:
/rest/process-instance/{id}
Get Variables History for All for Process Instance
/rest/history/variable-instance
Get Variables History with Current filter by Process ID
/rest/history/variable-instance?processInstanceIdIn={id}
Get Current Task Variables by Process ID
/rest/variable-instance?processInstanceIdIn?processInstanceIdIn={id}
Get All Task History for all Process ID
/rest/history/task
Get All Active Task
/rest/task
Get All Task History filter by Process ID
/rest/history/task?processInstanceIdIn={id}
Get Current Task filter by Process ID
/rest/task?processInstanceIdIn={id}
Get All Process Instance Id History
/rest/history/process-instance
In advance, thanks a lot, your help is highly appreciated.
@psilvaricardo, you can find in this example how to access process engine services. There are many ways to access process engine services.
@Component
public class CamundaServices{
@Autowired
private ProcessEngineService processEngineService;
public void getServiceData(String engine) {
ProcessEngine processEngine = processEngineService.getProcessEngine(engine);
processEngine.getRuntimeService().createProcessInstanceQuery().active().list();
processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId("processInstanceId").singleResult();
processEngine.getHistoryService().createHistoricVariableInstanceQuery().list();
processEngine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId("processInstanceId").singleResult();
processEngine.getHistoryService().createHistoricTaskInstanceQuery().list();
processEngine.getHistoryService().createHistoricProcessInstanceQuery().list();
processEngine.getHistoryService().createHistoricTaskInstanceQuery().processInstanceId("processInstanceId").singleResult();
processEngine.getTaskService().createTaskQuery().list();
processEngine.getTaskService().createTaskQuery().processInstanceId("processInstanceId").singleResult();
}
}
2 Likes
Hi @aravindhrs
I really appreciate your help with this, seems that, this could be the JAVA APIs I was looking for, I will be doing some tests and I will share my results shortly.
Thank you
Best regards.
Hi @psilvaricardo,
you can have a look into the original implementation of the rest api: https://github.com/camunda/camunda-bpm-platform/tree/master/engine-rest/engine-rest
It’s just a wrapper around the java api and it’s open source 
Hope this helps, Ingo
1 Like
@Ingo_Richtsmeier Thanks for your feedback