Using the Command Line Interface (CLI)

The Experience Cloud CLI lets you manage products that are part of the Squiz Digital Experience Platform (DXP).

If you are using Datastore, you will need to use the Command Line Interface (CLI) to deploy your blueprints.

Setting up the CLI

There are multiple steps required to set up the CLI. However, the process should not take long.

Install Node Package Manager (NPM)

You need to install Node and NPM to use the Experience Cloud CLI.

  1. Install Node and NPM from https://nodejs.org/en/download/.

  2. Ensure you have the right versions by running the following commands, which should each display a version number:

    npm -v
    node -v

    The output should be higher than version 7 for NPM and higher than version 14 for Node, both of which are the minimum supported versions.

If you already have Node and NPM installed, make sure you are using the minimum supported versions or higher.

Install the Experience Cloud CLI

  1. To install the Experience Cloud CLI package, run the following command:

    npm install --global @squiz/dxp-cli
  2. When the command has run, you should see the following output:

    ✔ Successfully added plugins
    @squiz/dxp
     - plugin
     - plugin add
     - plugin list
     - plugin remove
    @squiz/dxp-plugin-core
     - help
     - login
     - logout
     - whoami

Uninstall the Experience Cloud CLI

Run the following two commands:

$ rm -rf ~/.config/dxp
$ npm uninstall -g @squiz/dxp-cli

You should get some output something like this:

removed 239 packages in 7.252s

You can now repeat the installation step above to install the latest version of the Experience Cloud CLI.

Update the Experience Cloud CLI to the latest version

When a new version of the Experience Cloud CLI is released, CLI will prompt the notification message on any command execution like:

$ dxp whoami
A new version of DXP CLI is available (x.1.x -> x.2.x). Do you want to continue without upgrading?

It is always recommended to update the Experience Cloud CLI tool to the latest version via dxp-upgrade command:

$ dxp-upgrade

The command installs the latest Experience Cloud CLI tool including all the existing plugins.

Test the Experience Cloud CLI

Now that you have installed the required plugins and the Experience Cloud CLI package, you can test it out by typing dxp into your console. This command lists the basic CLI commands that are now available to you.

  1. Type the following command and press enter:

    dxp
  2. You should see the following output:

      The command-line interface for dxp
    
      Usages
        $ dxp help <command>
        $ dxp login [--email|--phone-number|--username] [--password]
        $ dxp logout
        $ dxp plugin add <plugin> [<plugin>...]
        $ dxp plugin list
        $ dxp plugin remove <plugin> [<plugin>...]
        $ dxp whoami
    
      Options
        --lang The language to use when printing messages to the terminal
        --version Show the version number
    
      Examples
        $ dxp help add
        $ dxp login --email jdoe@squiz.net --password 'my-super-secret-password'

Adding plugins to the Experience Cloud CLI

If you want to use product-specific CLI commands, you must install the relevant plugins. For now, this only applies to Datastore, which is a command-line based tool.

Install the Datastore plugin using the following commands:

dxp plugin add @squiz/dxp-plugin-datastore

See Datastore overview for more information on using Datastore.

Signing into the CLI

Sign in to the CLI, use the dxp login command, and provide your email address and password:

dxp login --username 'jsmith@example.com' --password 'password'

If your sign-in is successful, you see the following confirmation in the terminal.

✔ Login to dxp succeeded

After signing in to Experience Cloud, you can confirm your authentication status with the dxp whoami command.

dxp whoami

If you authenticate successfully, the command returns your email address.

Sign out of the CLI

You can sign out at any time using the following command:

dxp logout

© 2015- Squiz Pty Ltd