I'm setting up Craft to be used headlessly with a mobile app, and content will be created several days before it is published. I want app admins to be able to see upcoming/pending entries. Is there a way to fetch all entries, not just currently published ones? When I do basic queries with the GraphQL api explorer I only see entries that are past their post date, but I'm a GraphQL newbie, so maybe I'm missing something?
If you want live
and pending
entries, you would need to pass status
to your query with the values you want (docs).
query yourQuery {
entries(section: "yourSectionHandle", status: ["live", "pending"]) {
title
}
}
Or if you want to use variables:
query yourQuery($section: [String], $status: [String]) {
entries(section: $section, status: $status) {
title
}
}
# query variables:
{
"section": "yourSectionHandle",
"status": ["live", "pending"]
}
If you want all entries, (disabled
and expired
included) you can use status:null
.