"operator" section doesn't work in POST /process-instance

Hello!

I’ve faced an issue with this request Get Instances (POST) | docs.camunda.org

According to docs I can make a request using “variables” with my camunda variable name and “operator” like “eq” and etc.

In my case I’m trying to make a request like:

{
“processDefinitionKeyIn”:[“workflow1”,“workflow2”],
“variables”:
[{
“name”: “client”,
“operator”: “like”,
“value”: “MyClient”
}]
}

where “client” is my custom variable.

And this request return nothing but status is 200. If I remove “variables” and my request will look like this:

{
“processDefinitionKeyIn”:[“workflow1”,“workflow2”]
}

it returns a list where I can find clients with name MyClient.

Also if I apply a similar filter in Tasklist UI with “client like MyClient” Camunda returns me a list with MyClients.

Maybe smb has met this issue before and know how to solve it and make a reuest with variables and operators?

Hi @mhais
I’ve performed a quick and simple test based on the description of the issue.
I started two instances and added a variable to one of them.
After that, I can successfully filter instances with a request similar to yours(Camunda version 7.15).

{
    "variables":
    [{"name": "bp3",
     "operator": "like",
     "value": "rocks"
    }],
    "processDefinitionKeyIn":["Process_10vrzz4"]
}

It’s hard to say what is going wrong in your case. It sounds like the filter can’t find process instances with a given variable filter. I would double-check it again.

Regards,
Alex

@mhais
The only way I can reproduce the behavior you described is if I filter Completed instances.
Start 3 instances, add a variable to two of them. Complete one of the instances with a variable and execute the request. You will see only one process instance returned because another one is already Completed.
You have to use another REST call to filter Completed instances - Get Process Instances | docs.camunda.org

Hope it helps.

Regards,
Alex

Hello Alex!

Sorry for so long responce.

I’ve fixed my issue using % sign in the bigining and ib the end of the value for “value” section. So my body now looks like:

{
“processDefinitionKeyIn”:[“workflow1”,“workflow2”],
“variables”:
[{
“name”: “client”,
“operator”: “like”,
“value”: “%MyClient%”
}]
}

I’ve found that Camunda engine use % while sending requests if we apply filters on UI.

Hi @mhais
Great that you were able to solve the issue.