How to get all tasks for a user via REST API?

1
0
-1

Hi,

I want to retrieve all the tasks for a user using the REST API, not only the assigned i want to retrieve the *pending *tasks too as the Bonita Portal does.

I've been using this , but it only retrieves the assigned tasks. I didn't find nothing in the documentation about pending tasks.

Any ideas?

Thank you.

Comments

Submitted by Sean McP on Sun, 11/15/2015 - 09:23

I think what you have to do is something like this:

Get the Group of the User,
Get the Unassigned Cases for the Group

then you can display what is "pending",

regards

Submitted by alegomez on Tue, 11/17/2015 - 14:40

Hi, thanks for your answer.

How can I get the assigned cases for the group?. Anyway, I'm not mapping actors using groups, only roles, then I've been trying get the tasks on that way, but it's hard and slow (it makes so many REST calls).

I thought BonitaSoft had made an API entry for this. :(

2 answers

1
+6
-1
This one is the BEST answer!

You can get this information only with one REST API call:

../API/bpm/humanTask?p=0&c=10&f=user_id={{ user_id }}

This example gets the first 10 tasks for a user.

It's late but you can implement this as a improvement. Bye

Comments

Submitted by kohirrajesh on Mon, 03/28/2016 - 08:45

Thanks Sir,
I used the approach suggested by you.

1
+1
-1

Well I had to use nested api calls for getting what I wanted.

Here a summary:

First I retrieved all the assigned tasks for the user, (../API/bpm/humanTask?p=0&c=10&f=name=TASK_NAME&f=assigned_id=USER_ID)

Then I retrieved the memberships for the user deploying the roles (../API/identity/membership?p=0&c=100&f=user_id=USER_ID&d=role_id)

With this I searched the tasks that match with the roles of the user. I filtered the tasks that are not assigned also.

And voilá. I've retrieved all the pending tasks for the user. Anyway, I hope on later versions Bonita has a REST API entry for this.

Comments

Submitted by Sean McP on Wed, 11/18/2015 - 17:50

Excellent!! And thank you for sharing

Notifications