Advanced API filter combining AND and OR

in a situation where you have an

((or or or) AND (or or or))

you can do something like this:

{{host}}/api/blog?sort=publishedAt%3Adesc
&populate=Tags.tags
&populate=Image
&pagination[page]=1
&pagination[pageSize]=25
&locale=en
&filters[$and][0][$or][0][title][$containsi]=important
&filters[$and][0][$or][1][introduction][$containsi]=important
&filters[$and][0][$or][2][body][$containsi]=important
&filters[$and][1][$or][0][tags][$containsi]=JAVA
&filters[$and][1][$or][1][tags][$containsi]=BE
&filters[$and][1][$or][2][tags][$containsi]=FE
&filters[$and][1][$or][3][tags][$containsi]=PYTHON
&filters[$and][1][$or][4][Tags][$containsi]=JAKARTAEE
&filters[$and][1][$or][5][Tags][$containsi]=SPRING

where [$and][0] or [$and][1] tells in what group the AND belongs and [$or][0] the OR in the AND group

It actually does make sense if you know how it works but OMG it took me forever to find this out. The documentation is not great in explaining this. It actually does not explain it at all :slight_smile:

4 Likes