Skip to content

contentstack/contentstack-export

Repository files navigation

Contentstack Export Utility

Note: The contentstack-export command-line utility will soon be deprecated. We recommend you to check out our latest CLI documentation for performing content management activities.

Contentstack is a headless CMS with an API-first approach that puts content at the centre. It is designed to simplify the process of publication by separating code from content.

This utility helps you to export content from Contentstack. The data is exported in JSON format and stored in file system.

Installation

Download this project and install all the modules using following command.

npm install

Configuration

Update configuration details at config/index.js

{
 master_locale: {
  name: '', // Stack's master locale. ex: 'English - United States'
  code: ''  // Stack master locale's code. ex: 'en-us'
 },
 email: '', // Your registered email id
 password: '', // Account password
 source_stack: '' // Stack api_key
 access_token: '' // Stack access_token
 management_token: '' //Stack management_token
 data: '' // Relative path to the directory, where exported data is to be stored. ex: './contents'
 ...
}

For switching to EU region update the hosts at config/default.js

{
  host:'https://eu-api.contentstack.com/v3',
  cdn: 'https://eu-cdn.contentstack.com/v3',
 ...
}

Usage

After setting the configuration, you'll can run the below given commands!

  1. Export all modules [ assets, locales, environments, extensions, webhooks, global_fields, content_types and entries, labels ]
$ npm run export
  1. Export a specific module
$ npm run export-assets
$ npm run export-env
$ npm run export-locales
$ npm run export-extensions
$ npm run export-webhooks
$ npm run export-globalfields
$ npm run export-contenttypes
$ npm run export-entries
$ npm run export-labels

Note: Before exporting entries, you must export locales, assets and content types.

Note: If you keep the value of preserveStackVersion to true, then you will have to provide the email and password mandatorily in the config file, the management token will not work in that case.

Known Limitations and Issues

  • If 2 assets share same uid and filename, only the first version of the asset would be available
  • Does not support the following
    • Roles
    • Users
    • Releases
    • Workflow

License

This project is licensed under MIT license