How to create a model entry as a draft programmatically?

System Information
  • Strapi Version: 3.6.5
  • Operating System: Linux
  • Database: Sqlite
  • Node Version: v14.17.0
  • NPM Version: 6.14.13
  • Yarn Version: 1.22.10

I have this code in a custom controller that successfully created the an entry:

let r = await strapi.query('restaurant').create(data);

Unfortunately, the created restaurant is already published. How could I create a draft version of it ?

Any pointer highly appreciated :slight_smile:

Thanks.

set data.published_at = null

2 Likes