Strapi endpoints returns 404 not found

System Information
  • Strapi Version: 5.0.3
  • Operating System: linux inside docker
  • Database: postgresql
  • Node Version: 18
  • Yarn Version: 1.22

Hi!
My endpoint returns 404 not found, even though an entity with this id exsists in the database and is published.
Likewise, all endpoints ending in :id (put, get) don’t work.

Even though clearly an endpoint with id 2 exsits, when i try to query “/api/tests/2” it returns 404 not found.

Both the find one and find are permitted for the public user.

Those endpoints were working before upgrading to strapi v5.

1 Like

Notice that I can access my whole array of items via this endpoint (replace ‘articles’ with your collection name):

http://localhost:1337/api/articles/?[populate]=*

This renders my array of articles. From this array, I can see the new identifier affixed to each item in that array: documentId.

So previously we would have called … localhost:1337/api/articles/1?[populate]=*

We now have to call … localhost:1337/api/articles/:documentId?[populate]=*
e.g.: … localhost:1337/api/articles/j5ei9sn4i25cvlzzz5xo89gv/?[populate]=*

These requests correspond with these examples:
image
Which can be found here: REST API reference | Strapi 5 Documentation

My only gripe is that there doesn;t seem to be a way of knowing what the documentId per item is without first making a call to our whole items array. Perhaps someone knows how we can make this documentId value visible in our collection types?

I fixed the issue -
It turns out in strapi v5 it’s a breaking change.
There’s a new field in every record - documentID and you have to use that instead of id. The 404 are correctly 404, you just have to use the right id.

1 Like