Custom api in strapi

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hi all,

I am new to strapi and i want to know if there is any way to get all fields through any wildcard character in the custom api unlike specifying all the fields. My collection contains various nested components and i am not able to fetch all the components like any default api.

Please let me know how to get all characters or how to specify fields in the field array when our fields are object arrays

You mean to fetch each fields of a model and its components and sub components?

Yes @Shekhar
Through custom api endpoint. i am able to get non-componental field only

For that you need to use populate with whole component selection. Go through the below query example in order to fetch each fields of collection & mentioned components.

await strapi.db.query('api::collection-name.collection-name').findOne({
  populate: ['componentName','componentName.subComponentName'] 

Thank you @Shekhar ,It worked

1 Like