Camunda grouping by - using REST API

Hello everyone,
I want to exctract/ filtaring/grouping by the process instancess according to a specific process instance variable, if there is a process instance that called insert product details and quantity, in this process instance there are several variables that should be insert like, product name, product quantity, product type …
I want to grouping by all the process instances that have similar product name,
how can I do that?