Hi all,
I have questions about using expression to filter contacts when I using REST API
My software
My Mautic version is: 3.3.1
My PHP version is: 7.3.27
My Database type and version is:
My problem
I have contacts table (export excel)
| id | industry | city | |
|---|---|---|---|
| 1 | xxx@gmail.com | `X_1 | X_2 |
| 2 | xxy@gmail.com | X_2 |
Ho Chi Minh |
| 3 | xxz@gmail.com | `X_1 | X_4` |
| 4 | xxt@gmail.com | X_1 |
Ha Noi |
Included: industry: multiple choices, I see mautic saves value collapsing by |
I want to filter contacts having the condition:
-
The contacts have
industryhave value(X_1 or X_2 or X_3)andcitycontains patternHa noi -
…
I wrote:
Ex1:
[MauticURL]/api/contacts?where[0][col]=industry&where[0][expr]=in&where[0][val]=X_1,X_2,X_3&where[1][col]=city&where[1][expr]=like&where[1][val]=‘%Ha Noi%’
Result:
| id | industry | city | |
|---|---|---|---|
| 4 | xxt@gmail.com | X_1 |
Ha Noi |
Ex2:
[MauticURL]/api/contacts?orWhere(where[0][col]=industry&where[0][expr]=in&where[0][val]=X_1)&orWhere(where[0][col]=industry&where[0][expr]=in&where[0][val]=X_2)orWhere(where[0][col]=industry&where[0][expr]=in&where[0][val]=X_3)
I see the orWhere in doc but when I use, response returns Looks like I encountered an error (error #500).
Expected result:
| id | industry | city | |
|---|---|---|---|
| 1 | xxx@gmail.com | `X_1 | X_2 |
| 4 | xxt@gmail.com | X_1 |
Ha Noi |
How can I do that? Thank you so much.