Import Content using CLI

After exporting the content, the next step is to import it in the destination stack. By using the import commands, you can import your content and get started.

Content can be imported in a stack for the following modules:

  • Assets
  • Locales
  • Environments
  • Extensions
  • Webhooks
  • Global Fields
  • Content Types
  • Entries
  • Labels

Prerequisites

Commands

The cm:import command lets you import content to your destination stack. Let’s see how you can use this command in different ways.

Import Content Using Management Token and Parameters

Usage

csdx cm:import -a <management_token_alias>

Options

  • -a, --management-token-alias=management-token-alias: The management token of the destination stack to which you will import the content
  • -l, --master-lang=master-lang: The code of the target stack’s master language
  • -d, --data=data: The path or the location in your file system where the content, you intend to import, is stored
  • -m, --module=module: (optional) Specify the module to import into the target stack. If not specified, the import command will import all the modules into the stack. The available modules are assets, content_types, entries, environments, extensions, global_fields, labels, locales, and webhooks.

Import Content Using Management Token and Config file

Usage

 csdx cm:import -a <management_token_alias> -c <config_file_path> 

Options

  • -a, --management-token-alias=management-token-alias: The management token of the destination stack to which you will import the content
  • -c, -config: The path of the JSON file containing all the options for a single run. You can refer to an example config file here

Import Content Using Auth Token and Parameters

Usage

csdx cm:import -A

Options

  • -A, --auth-token: To use the auth token of the current session. It is automatically generated and stored in the session after running the login command.
  • -l, --master-lang=master-lang: The code of the target stack’s master language
  • -d, --data=data: The path or the location in your file system where the content, you intend to migrate, is stored
  • -s, --stack-uid-stack-uid: The API key of the target stack
  • -m, --module=module: (optional) Specify the module to import into the target stack. If not specified, the import command will import all the modules into the stack. The available modules are assets, content_types, entries, environments, extensions, global_fields, labels, locales, and webhooks.

Import Content Using Auth Token and Config file

Usage

csdx cm:import -A -c <config_file_path> 

Options

  • -A, --auth-token: To use the auth token of the current session. It is automatically generated and stored in the session after running the login command.
  • -c, -config: The path of the configuration JSON file containing all the options for a single run. You can refer to an example config file here.

Limitations

  • The import commands will import only the latest version of a published entry/asset.
  • Currently, you cannot import content for the following modules:
    • Roles
    • Users
    • Releases
    • Workflow

Additional Resources: Check out the Export Content documentation to learn how you can export content from your stack using CLI. 

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

top-arrow