Stop strapi from automatically publishing?

Hi there,

maybe I’m blind, but how exactly can I tell Strapi not to publish when I’m creating entries via functions? I just want to import data from an external source and save them as a draft. Those entries have to be reviewed and then published by hand.

So far i’ve tried “status” and “_publicationState”, but apparently it doesn’t work.

await data.data.data.items.forEach(async (element) => {
  await strapi.query('partner').create({
    name: element.programName,
    _publicationState: 'preview'
  });
});

Don’t mind the data.data stuff. Still working on it. :smiley:
Thanks

1 Like

I’m having the same issue! Could you find a way? @BlindPenguin

I just found a way!

Just pass the field “published_at” as NULL and it will be automatically saved as a draft :smiley:

@BlindPenguin

await this.$strapi.create("comments", {
    article: this.article,
    author: this.author,
    description: this.description,
    email: this.email,
    **published_at: null,**
  });