API endpoint to get items with certain values in two relations

I struggle to get strapi rest api to return a restaurant that has certain values in two realations. The documentation does not tell me the answer.

My structure:

Restaurants has two relations and some data fields:

  • Name (data)
  • Image (data)
  • City (relation)
  • Foodtype (relation)

City has mutliple values

  • Berlin (id:1)
  • London (id:2)

Foodtype has multiple values

  • French (id:1)
  • Chinese (id:2)

I would like to create an API call that populates me all All images of Restaurants in Berlin with French food

I managed to populate All images of Restaurants in Berlin (so London is filtered out) but I would also like to reduce it to the restaurants with French food I used this GET call so far http://localhost:1337/api/cities/1?populate=restaurants.image

cities/1 reduces it to the City relation by ID. Can anybody advise me how I extend the API call to reduce it further to the foodtype relation for ID 1?

Hii

You can achieve by using object

const response = await strapi
      .query("image",restaurant)
      .find({ where: { city:<id>,foodType:<id> }, populate: true });