# Is it possible to restrict task query results to candidate groups over REST api?

**URL:** <https://forum.flowable.org/t/is-it-possible-to-restrict-task-query-results-to-candidate-groups-over-rest-api/4708>\
**Category:** Flowable Engine\
**Created:** [October 17, 2019, 11:15am UTC](https://forum.flowable.org/t/is-it-possible-to-restrict-task-query-results-to-candidate-groups-over-rest-api/4708 "2019-10-17T11:15:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarkStar1](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/darkstar1/32/394_2.png) [@DarkStar1](https://forum.flowable.org/u/DarkStar1)\
**Post date:** [October 17, 2019, 11:15am UTC](https://forum.flowable.org/t/is-it-possible-to-restrict-task-query-results-to-candidate-groups-over-rest-api/4708/1 "2019-10-17T11:15:45Z")

</div>

I haven’t come across anything to indicate as such in the docs, but is it possible to restrict the query return of tasks to, the **members of the candidate groups** assigned to the task(s) over REST?  
So e.g.  
I am a member of group 2, not listed as a candidate group for a group 1 task, so therefore I can not get the tasks for group 1 if I query for all tasks if I make the query over rest. It is also ok if this can be achieved by adding something to the query parameter except the candidate groups parameter, since that can result in a very long query string.

---

<div class="post-metadata">

**Author:** ![tjmac](https://avatars.discourse-cdn.com/v4/letter/t/bc8723/32.png) [@tjmac](https://forum.flowable.org/u/tjmac)\
**Post date:** [October 18, 2019, 12:15pm UTC](https://forum.flowable.org/t/is-it-possible-to-restrict-task-query-results-to-candidate-groups-over-rest-api/4708/2 "2019-10-18T12:15:32Z")

</div>

Have you looked at taskService query :  
taskService.createTaskQuery().taskCandidateGroup()

---

<div class="post-metadata">

**Author:** ![DarkStar1](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/darkstar1/32/394_2.png) [@DarkStar1](https://forum.flowable.org/u/DarkStar1)\
**Post date:** [November 8, 2019, 9:39am UTC](https://forum.flowable.org/t/is-it-possible-to-restrict-task-query-results-to-candidate-groups-over-rest-api/4708/4 "2019-11-08T09:39:40Z")

</div>

Any reply on this please?  
According to the docs, [it should be possible](https://www.flowable.org/docs/userguide/index.html#restTasksGet) but a query over rest like:  
[http://localhost:9090/process\_engine/process-api/runtime/tasks?candidateGroups=GROUP\_site\_myTestGroup](http://localhost:9090/process_engine/process-api/runtime/tasks?candidateGroups=GROUP_site_myTestGroup) retuns nothing.  
I should add that I’m working with a springboot application that is using a WIP (work-in-progress) IDM and the IDM works fine with group queries right now.

---

<div class="post-metadata">

**Author:** ![DarkStar1](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/darkstar1/32/394_2.png) [@DarkStar1](https://forum.flowable.org/u/DarkStar1)\
**Post date:** [November 11, 2019, 10:18am UTC](https://forum.flowable.org/t/is-it-possible-to-restrict-task-query-results-to-candidate-groups-over-rest-api/4708/5 "2019-11-11T10:18:39Z")

</div>

> [@tjmac](#):
>
> Have you looked at taskService query :  
> taskService.createTaskQuery().taskCandidateGroup()

I saw that but I was really after asking about doing this over the out of the box REST api

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [November 20, 2019, 8:13am UTC](https://forum.flowable.org/t/is-it-possible-to-restrict-task-query-results-to-candidate-groups-over-rest-api/4708/6 "2019-11-20T08:13:07Z")

</div>

Looking at the code where the candidateGroups parameter gets handled, that should work: [https://github.com/flowable/flowable-engine/blob/master/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskCollectionResource.java#L177](https://github.com/flowable/flowable-engine/blob/master/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/runtime/task/TaskCollectionResource.java#L177)

Have you made sure there’s nothing weird going on with url encoding? Can you debug that particular line?
