Fetching Unpublished Content via API in Production Environment

System Information
  • Strapi Version: v4.11.0
  • Operating System: Ubuntu 22
  • Database: sqlite
  • Node Version: 18.12.1
  • NPM Version: 8.19.2
  • Yarn Version: -

Hello Strapi Community,

I’ve been working with Strapi for a while and I find it an excellent headless CMS for my needs. Currently, I’m using the draft & publish feature in Strapi for my profile content type .

I understand that for security and content management reasons, Strapi’s default behavior is to only allow fetching of published content via the API. This is a great feature and makes perfect sense for most production scenarios.

However, for a specific use-case in my project, I need to fetch unpublished (draft) profiles in a production environment. I am aware of the potential security implications and have measures in place to ensure that this data won’t be exposed inappropriately.

I was wondering if there’s a recommended method or a best practice to fetch unpublished profiles via the API in a production environment, perhaps through some advanced configurations or plugin development? Any guidance or help on this matter would be greatly appreciated!

Thanks in advance for your time and assistance.

Please refer to this How to publish/unpublish programmatically | The Missing Strapi Docs

For to not published ```
publishedAt: null // No Date Set

You can now do this via publication state: https://docs.strapi.io/dev-docs/api/rest/filters-locale-publication#publication-state