CLI-Supported Features for Export, Import, and Clone Operations
Contentstack CLI offers support for export, import, and clone operations, including Marketplace apps, module-wise imports, error handling, and Personalize project integration.
This guide outlines these features to help you manage content migration operations with flexibility and control.
Marketplace Apps
You can export/import public and private Marketplace apps into a stack using CLI commands.
Prerequisites
- Logged in to your Contentstack account
- Owner/Admin rights to export Marketplace apps
- Marketplace apps support enabled in the destination organization
- Only the latest version of a public or private Marketplace app can be installed via CLI.
- If you're using a region other than AWS NA, AWS EU, AWS AU, Azure NA, Azure EU, GCP NA, or GCP EU, provide the Developer Hub URL when prompted.
- To override the default Marketplace app encryption key, update the config.json file.
Public Apps
If a public Marketplace app with a specific configuration already exists in the destination organization, you will be prompted with the following options during import:
- Update the app with the new configuration from the source organization.
- Skip updating the app configuration.
Warning: Skipping may result in issues with imported content.
- Exit to cancel the entire stack import process.
Private Apps
If the imported app has the same name as an existing app in the destination stack:
- You will be prompted to rename the imported app.
Note: App names must be 3-20 characters long.
During the stack import:
- If acknowledged and confirmed, the listed private app(s) will be re-created and installed.
- If you cancel the app recreation, it may disrupt the import process of entries, content types, or global fields.
- To skip re-creation of private apps if they already exist, use the --skip-app-recreation flag.
csdx cm:stack:import -k <<stack_ApiKey>> -d <<path_of_folder_where_content_is_stored>> --skip-app-recreation --yes
Error Handling
If an error occurs while importing a public or private app:
- You will be prompted to confirm whether to proceed.
- If you choose not to proceed, the import stops.
- If you choose to proceed, the import may still succeed but could affect entries, content types, or global fields.
Note: You cannot reuse any existing private apps during the import process.
Personalize and Entry Variants
When working with stacks that are synced with a Personalize project, certain modules and configurations are automatically handled during export and import operations:
Exporting
If the stack you're exporting is linked to a Personalize project, the following items will be exported:
- The associated Personalize project
- The following modules within the Personalize project:
- Entry Variants (exported from the stack as part of entries)
Importing
If the content you're importing is associated or synced with a Personalize project, a new Personalize project will be created and linked to the new stack. Additionally, the items below will be imported into the target stack:
- The following modules within the Personalize project:
- Experiences
- Audience
- Attributes
- Events
- Entry Variants (imported into the stack as part of entries)
Options
- --personalize-project-name: (optional) Provide a unique name for the Personalize project.
Note: Variants and Personalize currently support only basic authentication.
Personalize and Entry Variants Limitation
The -a <alias> flag skips Personalize modules as they require an auth token for import and cannot be imported using a management token.