Setting up the CLI tool
This page guides you through how to install and configure the CLI tool. The CLI tool includes comprehensive online help and we show you how to use the to get more information about the parameters and options for each command.
Installing the CLI toolLink copied!
You can install the CLI tool using the Node package manager with the following command:
You can also download an executable for macOS, Windows or Unix from the releases page on GitHub.
Getting helpLink copied!
The CLI tool contains documentation built in to help you use each command. To get help type the following into the command line:
The list of available commands and options is displayed:
To get help for a specific command, add --help to the end of the command.
For example, to get more information about what you can do with content type schemas, enter the following in the command line:
The commands and options available for content type schemas will be displayed by appending --help.
Setting up your access IDs and keysLink copied!
API key and secret key
The CLI tool uses the Dynamic Content Management API which is authenticated using an API key and secret. You should request an API key and secret with the developer persona and with permission to read and write to the hubs that you want to use.
Hub ID
The hub ID is available from the "Properties" menu in the Dynamic Content app, as shown in the image below. Click the icon to the right of each hub id to copy it.
Repository ID (repoId)
The id of each repository in a hub is shown in the repository window.
Folder ID (folderId)
You can choose to copy and export content from a folder specified with its folderId. To find a folderId use the Content Management API, as explained in the finding folderIds section.
ConfigurationLink copied!
Each CLI tool command will require an API key and secret. This can either be specified on the command line or read from a configuration file. To set up a configuration use the configure
command:
Specify the client Id, secret and the hub you want to perform operations on from the command line:
By default the configuration file will be written to a file name "dc-cli-config.json" in a directory in your home folder, but you can specify another location in the config
option.
If you are using multiple hubs and multiple keys and secrets, you may want to create multiple configuration files. Alternatively you can specify the client Id, secret and hub Id for each command.