I am using camunda_bpm_api
( git url and the module in drupal8 camunda+drupal8 sample module) module connect my custom application in drupal to camunda server .
I was retrieving the process definitions
using the function as follows :
private function fetchProcessDefinitions() {
return \Drupal::service('camunda_bpm_api.process_definition')->getList();
}
This is working properly .
How do i retrieve the task assigned to a particular user ? I was trying as follows :
public function fetchTaskList() {
$payload = array('assignee' => 'nimyav');
return \Drupal::service('camunda_bpm_api.task')->getList($payload);
}
But its retriveing all the tasks
irrespective of the assignee
?
How do i achieve this ? any help is appreciated .
Just to double check that you are getting the result, what happens if you call curl -X GET "http://localhost:8080/engine-rest/engine/default/task?assignee=nimyav" -H "accept: application/json"
assuming that your BPM engin is installed locally? If you don't use curl, you could just open the browser with the URL http://localhost:8080/engine-rest/engine/default/task?assignee=nimyav. Do you see tasks assigned to you only?
Generally, your request seems ok, but passing no second parameter to the getList()
you are using it in HTTP GET mode. If you look at Camunda REST docs, you will notice that some methods are available as GET and as POST methods. Especially, I believe that Valentin designed the getList
method to work in HTTP POST mode, because it is passing parameters in the request body (please check the camunda_bpm_api/src/BPMPlatform/BaseService.php
for more details).
Please try to call the service like this:
public function fetchTaskList() {
$payload = array('assignee' => 'nimyav');
$usePost = TRUE;
return \Drupal::service('camunda_bpm_api.task')->getList($payload, $usePost);
}