Getting filtered json result set as an output

Hi, I am having a 3 level nested hierarcy structured data model. When I use enrich=true in my Rest API/GraphQL query I am getting the results but it is also providing me the fields in the result set which are not required e.g. lastUpdatedBy, published, firstPublished, and there are many more.

There is a way to either include or omit the fields but for that the inner refers entries also have to be explictly added in the omit, due to this the fields are increasing in number. If the requirement comes to display more no of fields it could create a problem as maintaining this huge list of fields for each level of nesting is a difficult task.

Can you please suggest some other alternate way to address it.

Hello @shaileshbassi,

You can customize the fields included in your query response using the &fields=id,name,data.customField parameter to select specific fields, or &omit=data.bigField,data.blocks to exclude certain fields.

For example, in the REST API:

To include specific fields:
https://cdn.builder.io/api/v3/content/my-model-name?apiKey=YOUR_API_KEY&fields=id,name,data.customField

To exclude specific fields:
https://cdn.builder.io/api/v3/content/my-model-name?apiKey=YOUR_API_KEY&omit=data.bigField,data.blocks

You can find more information about customizing fields in the Builder.io Content API documentation.

Please let us know if you need further assistance!