How to change the response schema?

Hello guys, I’m a beginner of strapi

I’m using strapi 4.10.5, and I have create a collection type and get data by calling REST API, and I found there’s always a wrapper called “data”, like

{
    "data": [
        {
            "id": 1,
        }
    ],
    "meta": {
        "pagination": {
            "page": 1,
            "pageSize": 25,
            "pageCount": 1,
            "total": 1
        }
    }
}

Is there any way to remove data and meta? I mean only leave the data in “data” field

[ {
            "id": 1,
} ]

Great appreciate!

There is but I wouldn’t do it, you will be breaking functionality that could be useful when you have 1,000’s of records and it’s only returned 25 records

This page will help you, I’d suggest creating a custom controller in your situation instead of modifying a common endpoint.

1 Like

Ah, get it, thanks for your help!