Skip to main content

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 tool
Link copied!

You can install the CLI tool using the Node package manager with the following command:

npm install -g @amplience/dc-cli

You can also download an executable for macOS, Windows or Unix from the releases page on GitHub.

Getting help
Link copied!

The CLI tool contains documentation built in to help you use each command. To get help type the following into the command line:

dc-cli --help

The list of available commands and options is displayed:

dc-cli <command>

Commands:
dc-cli configure Saves the configuration options to a file
dc-cli content-item Content Item
dc-cli content-repository Content Repository
dc-cli content-type-schema Content Type Schema
dc-cli content-type Content Type
dc-cli event Event
dc-cli extension Extension
dc-cli hub Hub
dc-cli search-index Search Index
dc-cli settings Settings

Options:
--help Show help [boolean]
--version Show version number [boolean]
--clientId [string] [required]
--clientSecret [string] [required]
--hubId [string] [required]
--config Path to JSON config file

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:

dc-cli content-type-schema --help

The commands and options available for content type schemas will be displayed by appending --help.

Content Type Schema

Commands:
dc-cli content-type-schema archive [id] Archive Content Type Schemas
dc-cli content-type-schema create Create Content Type Schema
dc-cli content-type-schema export <dir> Export Content Type Schemas
dc-cli content-type-schema get <id> Get Content Type Schema by ID
dc-cli content-type-schema import <dir> Import Content Type Schemas
dc-cli content-type-schema list List Content Type Schemas
dc-cli content-type-schema unarchive Unarchive Content Type Schemas
[id]
dc-cli content-type-schema update <id> Update Content Type Schema

Options:
--version Show version number [boolean]
--clientId [string] [required]
--clientSecret [string] [required]
--hubId [string] [required]
--config Path to JSON config file

Setting up your access IDs and keys
Link 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.

You can find the id of each hub from the properties window

Repository ID (repoId)

The id of each repository in a hub is shown in the repository window.

The id of each repository in a hub is shown in repository settings

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.

Configuration
Link 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:

dc-cli configure

Saves the configuration options to a file

Options:
--help Show help [boolean]
--version Show version number [boolean]
--clientId [string] [required]
--clientSecret [string] [required]
--hubId [string] [required]
--config Path to JSON config file
[string] [default: "/Users/yourUserName/.amplience/dc-cli-config.json"]

Specify the client Id, secret and the hub you want to perform operations on from the command line:

dc-cli configure --clientId <yourClientId> --clientSecret <yourSecret> --hubId <hubId>

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.

Dynamic Content CLI tool on GitHub