Below are common issues regarding content types and their possible solutions.
- Collection endpoints use their plural name. e.g.
/api/posts
- Single types use the singular name. e.g.
/api/homepage
For single content types if draftAndPublish
is enabled the response will return a 404 Not Found if the entity is not published.
For routes that should be discoverable to the public the following must be true:
- find is checked in the following location Settings -> [User and Permissions] Roles -> Public -> Respective Content Type.
- No Authorization header is being sent with the request.
For routes that should be discoverable to authorized users only the following must be true:
- find is checked in the following location Settings -> [User and Permissions] Roles -> Authenticated -> Respective Content Type.
- A valid Authorization header is being sent with the request.
By default Strapi only returns published records, navigate to the respective content type and Publish a record. Retriggering the request should now return the newly published record.
If you want the records returned irrespective of publication state their is an example in the strapi docs on how to do so in the green tip area.
By default relations,components and images are not populated on the request. To have them returned in the request the populate parameter is required.
Ensure that the user making the request has access to the relation content type. You can do so by going to the following location Settings -> [User and Permissions] Roles -> Relevant user role (i.e Public or Authenticated) -> Respective Content Type and confirming that find/findOne are enabled.