Strapi query for relation with IN filter and AND clause

Viewed 1518

I have a collection blogs that has&belongs to many categories which have a title field.

I want to query blogs for results that have at least two specific category titles: foo and bar.

my blogs has the following entries:

  • 2 entry with 0 categories
  • 1 entry with 1 category: foo
  • 1 entry with 2 categories: foo, bar

I've tried:

GET /blogs?_where[0][categories.title_in]=foo&_where[1][categories.title_in]=bar

--> 0 results

GET /blogs?[categories.title_in]=foo&[categories.title_in]=bar

--> 2 results

GET /blogs?[categories.title_in][0]=foo&[categories.title_in][1]=bar

--> 2 results

Basically I cannot get the AND condition to take. Filtering for both having foo AND bar categories should return only 1 result (the last one in the example)

How do I do that?

0 Answers
Related