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

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.

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.

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

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

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. :frowning:

Excellent!! And thank you for sharing

Thanks Sir,
I used the approach suggested by you.