Taxonomy Migration
Note: The Taxonomy feature is currently released as part of an Early Access Program and may not be available to all users. For more information, you can reach out to our support team.
With the Taxonomy Migration utility, you can import the taxonomies and respective terms using a CSV file created using one of the following methods:
- export-to-csv plugin
- CSV template
This step-by-step guide lets you use the Taxonomy Migration utility to perform the taxonomy migration operation on a stack.
Prerequisites
- Contentstack account
- CLI installed and configured (version 1.7.0 and above)
- CLI authenticated
- CSV file (generated using the export-to-csv plugin or a CSV template)
Note: If you are using a CSV template to generate the CSV file, the Taxonomy Name and Term Level* Name fields are mandatory.
Additional Resource: Here is a sample script to import taxonomies into your stack. Preferably, use this sample script to try out the commands in this guide.
Usage
csdx cm:stacks:migration --file-path <value> --config data-dir:<value> --stack-api-key <value>
Options
- -k, --stack-api-key=stack-api-key: Stack API key.
- --config=config: [Inline configuration] The key for receiving data-dir and delimiter. To provide the path of the CSV file in the data-dir, use data-dir:<value>. If you used a delimiter while exporting or manually creating taxonomies to CSV, use {data-dir:<value>,delimiter:<value>}.
- --file-path=filepath: Path where the taxonomy migration files are stored.
Tip: Preferably, use the sample taxonomy migration script to import taxonomies.
Example
Without delimiter:
csdx cm:stacks:migration -k b*******9ca0 --file-path "../contentstack-migration/examples/taxonomies/import-taxonomies.js" --config data-dir:'./data/Taxonomy Stack_taxonomies.csv'
Note: For Windows OS, use "\" instead of "/" for paths.
With delimiter (Mac OS):
csdx cm:stacks:migration -k b*******9ca0 --file-path "../contentstack-migration/examples/taxonomies/import-taxonomies.js" --config {data-dir:'./data/Taxonomy Stack_taxonomies.csv',delimiter:'|'}
With delimiter (Windows OS):
csdx cm:stacks:migration -k b*******9ca0 --file-path "..\contentstack-migration\examples\taxonomies\import-taxonomies.js" --config data-dir:'.\data\Taxonomy Stack_taxonomies.csv',delimiter:'|'
Steps for execution
Follow the steps below to run the taxonomy migration command:
- Provide the following flags in the cm:stacks:migration command to import taxonomy:
- File path that contains the taxonomy migration files.
Note: Provide the file path of the downloaded sample script.
- Stack API key
- Config that contains the CSV file path and the delimiter
Note: You must provide a delimiter in config only if you used a delimiter while exporting taxonomies to CSV or generating CSV file manually.
csdx cm:stacks:migration --stack-api-key <value> --file-path <value> --config {data-dir:<value>,delimiter:<value>}
- File path that contains the taxonomy migration files.
- Run the command in your terminal.
You have successfully migrated taxonomies from your CSV file to the provided stack.
Without delimiter:
With delimiter (Windows OS):
With delimiter (Mac OS):