Search user tasks

Hi,

I want to use the OR operator to search for User Tasks using the v2 endpoint. The documentation is missing a good example but according to the Camunda Docs AI the following query should work:

curl --location 'http://localhost:8088/v2/user-tasks/search' \
--header 'Content-Type: application/json' \
--data '{
  "filter": {
    "$or": [
      { "assignee": "john.doe" },
      { "candidateGroups": "my-group" }
    ]
  }
}}'

However, Camunda returns the following error:

{"type":"about:blank","title":"Bad Request","status":400,"detail":"Request property [filter.$or] cannot be parsed","instance":"/v2/user-tasks/search"}

What am i doing wrong? I am using c8run version 8.9.0

Your syntax looks correct according to the documentation, but there might be a compatibility issue with c8run version 8.9.0. I found the following relevant resources:

Does this help? If not, can anyone from the community jump in? :waving_hand:


:light_bulb: Hints: Use the Ask AI feature in Camunda’s documentation to chat with AI and get fast help. Report bugs and features in Camuda’s GitHub issue tracker. Trust the process. :robot:

Hi @Maarten_van_Veelen
I do not think that the usage of $or is supported for v2/user-tasks/search. I think the documentation might be a bit confusing in that part. It does mention logical operators, but that doesn’t mean it supports direct usage of $or.

You might need to run a query by assignee and another query by candidate group, and then merge the results.

Regards,
Alex

You are not doing anything wrong with the JSON syntax, the problem is that `/v2/user-tasks/search` does not support a top-level `$or` filter there, so the parser rejects `filter.$or`. There is also a second limitation here: in Tasklist/API V2, candidate-group based task access/search from the old Tasklist API is not supported anymore. The docs call this out under Tasklist V1 vs V2, so a query like “assignee = john.doe OR candidateGroups = my-group” is not something V2 can express in one search request. So in 8.9 your practical options are: 1. run separate searches and merge the results client-side, or 2. stay on Tasklist V1 if your use case depends on candidate-group style filtering. If you only need the assignee part, this should work fine: ```json { “filter”: { “assignee”: “john.doe” } } ``` If you want, I can dig up the exact V2 docs section that mentions the V1-only limitations and the supported filter shape for `user-tasks/search`.

Thanks @Taylor_Brooks and @Alex_Voloshyn . It is a pitty that the OR operator does not work/exist although the documentation says it does. I will try to solve the problem using two or more calls indeed.

btw: the query is just an example (the one that Camunda documentation AI bot gave me :wink: ).