Finally, I use this script and it works well.
'use strict';
/**
* foo controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::foo.foo', ({ strapi }) => ({
async create(ctx) {
const user = ctx.state.user; // if need
const { body } = ctx.request;
const newFoo = await strapi.entityService.create('api::foo.foo', {
data: body.data
});
return newFoo;
},
}));
In request, without publishedAt key, I can create a Draft Content.
This is partial example with Ruby.
options[:body] = {
data: {
title: 'test',
publishedAt: DateTime.now.iso8601, # comment out to create Draft
}
}