How can I do to get all the entities, even the draft ones? (from all the endpoint)
I’m making a dashboard that is only for admins, and those admins need to get ALL the entities.
Do I have to make a Rol for those users?
Try to use this parameter
?_publicationState=preview
2 Likes
And what’s the opposite? _publicationState=posted ?
If I do _pulicationState=preview its only returns the ones on draft mode (thanks for that)
It is live and preview
But I don’t know why… i thought it works, but it returns the same entity.
(I have two entities for test, one is published and the other not)
What an idiot, preview return all the entities haha, sorry
Strapi strikes again!
live: returns only published entries (default)
preview: returns both draft entries & published entries
It would be so easy and so useful to have preview
only return drafts and set all
as default to return all entries. For anyone interested I think a way to solve this is to use filters:
let entry = await strapi.entityService.findMany("api::coupon.coupon", {
filters: {
publishedAt: {
$eq: null,
},
},
})
But thanks Strapi for sticking to your basic philisophy of making things as complicated as possible for no reason whatsoever.