How to format api response structure in v4

[details=“System Information”]

  • Strapi Version: 4.0.6
  • Operating System: Ubuntu 20.04
  • Database: PSQL
  • Node Version: 16+
  • NPM Version: 8.1.2
  • Yarn Version: 1.22.17
    I want to format my response such that the api response has less data in it. Is it possible to change the response such that it only has fields that i added and for images a single link is there. If not, what are the options I can use to make my strapi api response less verbose in version 4.

One option would be to use the fields parameter to only return fields you need.

2 Likes

yes and to get more customized response you can also use : Filter Response

I need to remove attributes, data from nested levels response… So that it is nested correctly. U have any idea how it can be done. Is it possible to change the structure of layout?

GraphQl is built for this purpose, to filter and mutate in the actual request. Fetch only what you need