Introducing the CLI tool
The Dynamic Content CLI tool makes it easy to access the features of the Dynamic Content Management API via the command line. Using the CLI tool you can automate common tasks such as copying content from one hub to another, importing and exporting content type schemas and content types, copying hub settings and archiving events.
What the CLI tool can doLink copied!
With the CLI tool you can perform powerful operations in one command. In the example shown below we're copying content from a folder on one hub to a folder on another and then publishing the copied content.
dc-cli content-item copy
--srcFolder 6018216c52faff00011b2ea5 --dstFolder 5f89ce13cff47e000168dc0f --dstHubId 5cf679244cedfd000109d2ef --publish
You can can combine commands in scripts and automate a range of common tasks.
Here are some of the features that you can access from the command line using the CLI tool. For each command there are a number of options to help you configure the command to meet your requirements.
- Copy or move content between hubs or repositories on the same hub
- Import and export content items
- Revert a copy so that all the copied content is archived
- Import and export content type schemas
- Import and export content types
- Archive and unarchive content
- Import and export hub settings
- Assign and unassign content types to repositories
- Archive events
- Export and import extensions
- Clean and clone entire hubs
- Import and export search-indexes
What you can use the CLI tool forLink copied!
In this section we've included some common use cases for the CLI tool. It's not an exhaustive list and when you go through the examples and find out more about the functionality you'll probably identify more examples of how you can write some scripts to help enhance your own workflow.
Setting up a UAT or testing environmentLink copied!
If you're a developer adding new features such as previews and visualizations, or making changes to an integration, then you can use the CLI tool to copy live content into the UAT environment so you can be sure that everything works with the content that's used in a production environment.
Adding content for a new localeLink copied!
You can simplify your localization process by copying some content to the repository to which the new locale is assigned and then use these content items as the basis for your localized content.
Creating a new brandLink copied!
If you've got multiple brands within a hub you may want to copy common content from one respository to another as a quick starting point for content for the new brand.
Bulk import and export of content to and from another system- such as a translation providerLink copied!
If you're working with a translation provider you might want to export content to be translated so they can import it into a translation system. Once the content is translated you can import the content back into Dynamic Content. The CLI tool uses a mapping file to ensure that the content you import back into Dynamic Content is updated rather than new content items created.
Exporting content type schemas for storing in source controlLink copied!
You can import and export content type schemas and this is particularly useful if you want to store your schemas in a source control system. You can also make changes to schemas, re-import them and automatically sync a schema with its content type.
Moving content to reorganize itLink copied!
There are several ways you can use commands in the CLI tool to help re-organize your content. You can archive multiple content items, or copy or move selected content to a new repository to make it easier to focus on your chosen content.