System Information
- Strapi Version: 5.0.2 Community
- Operating System: Windows 11 Enterprise Version 23H2 (OS Build 22631.4169)
- Database: sqlite
- Node Version: 18.20.4
- NPM Version: 10.8.3
- Yarn Version: –
I created a Gift collection type with 3 data fields, they are Name, Description and Quantity. I entered a new record entry, published the record, and granted the find and findOne permission to the Public role.
I am able to get ALL records by following URL
localhost:1337/api/gifts/
The output:
{
"data": [
{
"id": 2,
"documentId": "bagsmgefw9wsmxe4po9qx47v",
"Name": "Moutai Spirit",
"Description": [
{
"type": "paragraph",
"children": [
{
"type": "text",
"text": "Moutai (simplified Chinese: 茅台; traditional Chinese: 茅臺; pinyin: máotái) is a style of baijiu made in the town of Maotai, Guizhou Province, China. Maotai is made from sorghum, a wheat based qū, and water from the Chishui River, and it uses traditional Chinese techniques of fermentation, distillation, and aging, to produce a spirit with a nutty, grain forward and savory aroma and flavor."
}
]
}
],
"Quantity": 100,
"createdAt": "2024-10-03T11:32:21.057Z",
"updatedAt": "2024-10-03T11:32:21.057Z",
"publishedAt": "2024-10-03T11:32:21.069Z",
"locale": null
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 1
}
}
}
However, I am not able to find that single record by ID, it returns 404 not found error.
{
"data": null,
"error": {
"status": 404,
"name": "NotFoundError",
"message": "Not Found",
"details": {}
}
}
also tried to use different ID, /api/gifts/1, /api/gifts/3 or use singular noun /api/gift/2, it still doesn’t work
The record in the database is as below, i.e. record ID 2 is published
I have no customization to this Gift collection type.
The controller of the Gift collection ./src/api/gift/controllers/gift.ts is as below:
/**
* gift controller
*/
import { factories } from '@strapi/strapi'
export default factories.createCoreController('api::gift.gift');
Do I miss any step before I can find individual record?