I’m getting to grips with Strapi’s API design approach as a headless solution for a startup I’m working in and I’m hitting a few stumbling blocks on the efficacy of its design. Where I see Strapi wins over the competition is how quick it is able to produce a valid API that’s easily consumed. However, I do have a couple of questions as to why certain decisions were made, which I hope the community can answer.
Why was the default response to provide everything you create on an endpoint but any components or images require an extra tag on the response? Are they not the same, despite being in line with the others fields inside the type builder? It seems this is the polar opposite of what a collection would be intended for. For example, if I add something to a collection like an image or a repeatable field then it always needs to come down in the response. There’s a private option for anything I don’t want to be returned.
I’ve yet to see a valid working customized controller/service capable of providing a single response without the extra bloat of the API stores in the back-end. This appears to be worse on images but the documentation doesn’t provide concrete examples on how to return only the fields you want returning, including components and media. Is this possible at the controller/service level?
The last question may be one of not knowing where the correct documentation is that explains this but I would expect it to be in the “Customising Controllers” section, which it isn’t.