Contentful logo

Contentful Community

How I can add sample entries to Content Type during creation of Content type using Migration CLI?

Hi,

I am creating new content type using Migration CLI. How I can add few sample entries to it?

module.exports = function(migration) {
var animal = migration.createContentType(‘animal’).name(‘Animal’).description(‘Animal desc.’);
animal.createField(‘animalName’).name(‘Animal Name’).type(‘Symbol’);
};
//I need to add few sample entries to this content type. How i can do this?

Hi @bharats,

The Migration CLI tool doesn’t provide a direct implementation in creating sample entries in a given content type created by the tool. However, it’d be pretty straightforward to do that with our SDK or Web Interface:

https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries/entry/create-update-an-entry/console/curl

Hi gabriel, Thank you for your reply on this.