Custom API to get Component

Hi,
I am building the exhibition app. There would be two screens: Galleries and Exhibitions.
So, there is a GalleryA which has two exhibitions. GalleryB has one.
I have built the content type builder where users can create a gallery entry, add info, and also add running exhibitions.

All of it I can access through api/galleries?populate=*

But, I also want to display ONLY all exhibitions from all the galleries on one screen. I don’t want to fetch the galleries, then loop through exhibitions, and then display them. My question: is there any way to create an API that will return me ONLY the exhibitions list?

Hope it makes sense for you :slight_smile:

Hey, you can follow this approach to create custom api using strapi. Use the linked example and append it with your custom logic.

Also refer to Query engine API docs for better clarification Query Engine API | Strapi Documentation

1 Like

Thank you. Will take a look!