System Information
- Strapi Version: 3.5.1
- Operating System: Ubuntu 20.04
- Database: MySQL
- Node Version: v14.15.5
- NPM Version: 6.14.11
- Yarn Version: 1.22.10
Hello,
I have a basic API with entries and related categories (many to many). A get request to /entries will return this:
[
{
"id": 1,
"title": "Test entry 1",
"published_at": "2021-02-23T21:49:28.000Z",
"created_at": "2021-02-23T21:48:33.000Z",
"updated_at": "2021-02-23T21:49:28.000Z",
"categories": [
{
"id": 1,
"name": "Test category 1",
"published_at": "2021-02-23T21:49:34.000Z",
"created_at": "2021-02-23T21:48:20.000Z",
"updated_at": "2021-02-23T21:49:34.000Z"
}
]
}
]
How would I go about limiting the populated fields for categories to just ‘id’ and ‘name’? The desired output is as follows:
[
{
"id": 1,
"title": "Test entry 1",
"published_at": "2021-02-23T21:49:28.000Z",
"created_at": "2021-02-23T21:48:33.000Z",
"updated_at": "2021-02-23T21:49:28.000Z",
"categories": [
{
"id": 1,
"name": "Test category 1"
}
]
}
]
Thanks so much for your time.