Filter by multiple categories (AND)

System Information
  • Strapi Version: 3.5.4
  • Operating System: Linux
  • Database: SQLite
  • Node Version: 15.11.0
  • NPM Version:
  • Yarn Version:

Hello all,

I try to filter entities (e.g. restaurants) for all entities having two relations with a name (e.g. categories) with the REST API.

For example having the data based on the quick start guide:

Biscotte Restaurant -> French Food, Brunch
Other Restaurant 1 -> French Food
Other Restaurant 2 -> Brunch
Other Restaurant 3 -> French Food, Brunch

I would like to get all restaurants which have the tag French Food and Brunch.

/restaurants?categories.name=Brunch returns Biscotte Restaurant, Other Restaurant 2 and Other Restaurant 3

/restaurants?categories.name=Brunch&categories.name=French%20Food returns all restaurants (French Food or Brunch).

So I think I need complex queries which would be: /restaurants?_where[0][categories.name]=French%20Food&_where[1][categories.name]=Brunch but this returns only an empty array ([]).

Is there any other way to query the data to get all the entities having multiple related entities?

Thanks
Dirk

Did you find a solution to this? I’m looking for a similar thing.

No, I filtered in the frontend. I think it does not work with the current way strapi works.