Create filters by Rest API documentation

Dear community,

I like to create filters by REST API.

How to do this can be found in the documentation.
https://docs.camunda.org/rest/camunda-bpm-platform/7.20-SNAPSHOT/#tag/Filter/operation/createFilter

The following code works fine.

{
   "resourceType": "Task",
   "name": "my filter",
   "owner": "",
   "query": {
      "candidateGroups": ["ADMIN"],
   },
   "properties": {
      "color": "#3e4d2f",
      "description": "0",
      "priority": 0
   }
}

Now I like to add the criteria Include assigned tasks.
Unfortunately I did not found any documentation showing all possible queries.

Does somebody know where I can find this information?

Thanks for your help.

BR

Michael

Hi @michael1

a filter which has the resourceType Task must contain a query which is a valid task query

so query corresponds to the JSON body of POST /task REST endpoint
https://docs.camunda.org/manual/7.18/reference/rest/task/post-query/#request-body

Hi Hassang,

thanks for the explanation, it works.

Below my two used REST calls, maybe it helps someone else.

REST endpoint: /engine-rest/filter/create

{
    "resourceType": "Task",
    "name": "Admin",
    "owner": "",
    "query": {
        "candidateGroups": ["ADMIN"],
        "includeAssignedTasks": true
    },
    "properties": {
        "color": "#3e4d2f",
        "description": "0",
        "priority": 0
    }
}

Filter with expression

{
    "resourceType": "Task",
    "name": "My tasks",
    "owner": "",
    "query": {
        "assignee": "${ currentUser() }"
    },
    "properties": {
        "color": "#3e4d2f",
        "description": "0",
        "priority": 0
    }
}

Have a great day!

Michael

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.