Export Content using CLI

If you want to migrate your content from one stack to another, first you need to export the content from the source stack and then import it in the destination stack.

You can export the following modules from a stack:

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

Prerequisites

Commands

The cm:export command lets you export content from one stack to another. Let’s see how you can use this command in different ways.

Export Content Using Management Token and Parameters

Usage

$ csdx cm:export -a <management_token_alias>

Options

  • -a, --management-token-alias=management-token-alias: The management token of the source stack from which you will export content
  • -l, --master-lang=master-lang: The code of the source stack’s master language. For e.g., en-us
  • -d, --data=data: The path or the location in your file system to store the exported content. For e.g., ./content
  • -m, --module=module: (optional) Specify a module to export to the source stack. If not specified, the export command will export all the modules to the stack. The available modules are assets, content_types, entries, environments, extensions, global_fields, labels, locales, and webhooks

Export Content Using Management Token and Config file

Usage

$ csdx cm:export -a <management_token_alias> -c <config_file_path>

Options

  • -a, --management-token-alias=management-token-alias: The management token of the source stack from which you will export content
  • -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

Export Content Using Auth Token and Parameters

Usage

$ csdx cm:export -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 source stack’s master language. For e.g., en-us
  • -d, --data=data: The path or the location in your file system to store the exported content. For e.g., ./content
  • -s, --stack-uid-stack-uid: The API key of the source stack
  • -m, --module=module: (optional) Specify the module to export to the source stack. If not specified, the export command will export all the modules to the stack. The available modules are assets, content_types, entries, environments, extensions, global_fields, labels, locales, and webhooks.

Export Content Using Auth Token and Config file

Usage

$ csdx cm:export -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

  • For assets, exporting two or more assets having the same UID and file name, then only the first asset in the queue will get exported.
  • Currently, you cannot export content from the following modules:
    • Roles
    • Users
    • Releases
    • Workflow

Next Steps

Now that you have exported the content, the next step is to import the content in the stack.

Was this article helpful?

Thanks for your feedbackSmile-icon

On This Page

top-arrow