I want create POST method to post an entry without publish it to the end users. Is it possible to do that in api?
System Information
-
Strapi Version: 3.5.4
-
Operating System: macOS 11.2.3
-
Database: sqlite
-
Node Version: 14.17.3
-
NPM Version: 6.14.13
-
Yarn Version: 1.22.10
Yes, set the published_at: null
during the POST request and it will be created as a draft. The default for REST/GraphQL sets that field to the current datetime. Passing over the null
value will leave it in a draft state.
1 Like
As of 7th February, the field is written publishedAt
and not published_at
as said before.
7 Likes
@DMehaffy But such approach has one disadvantage: if you are publishing an entity later (by setting publishedAt: Date) required fields validations are not performed. It means that entities with empty required fields will be able to be created.