I've Strapi 4. I'm getting error for API call
http://localhost:1337/api/customers/:1
{
"data": null,
"error": {
"status": 404,
"name": "NotFoundError",
"message": "Not Found",
"details": {}
}
}
For customers the API works fine
http://localhost:1337/api/customers
{
"data": [
{
"id": 1,
"attributes": {
"firstname": "John",
"createdAt": "2023-11-18T21:30:47.920Z",
"updatedAt": "2023-11-18T21:52:02.386Z",
"publishedAt": "2023-11-18T21:31:46.731Z",
"lastname": "Does"
}
},
{
"id": 2,
"attributes": {
"firstname": "Lilly",
"createdAt": "2023-11-18T21:31:38.210Z",
"updatedAt": "2023-11-18T21:52:17.782Z",
"publishedAt": "2023-11-18T21:31:41.103Z",
"lastname": "Filly"
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 2
}
}
}
I've set the roles on USERS & PERMISSIONS PLUGIN -> Roles, see the screenshot below. Am I missing anything else? How to fix it?
I think you are going to the wrong url. In this url, /:id
is given as an example for you and you must have forgotten to delete it.
change this
http://localhost:1337/api/customers/:1
to
http://localhost:1337/api/customers/1