1

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?

1 Answer 1

1

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.

1
  • This is perfect, thanks so much! Commented Nov 6, 2020 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.