Command Line

The Cloud CMS command-line client gives developers a way to work with their Cloud CMS tenant projects, applications, data stores and other resources from the command line. The CLI (command-line client) is a Node.js based command line tool that is very easy to use and available at no charge.

Note: A valid Cloud CMS subscription is required to connect to Cloud CMS with the command-line client. This subscription can be a paid subscription or a free trial account.

Getting Started

To get started, you need to install Node.js on your development laptop and then use NPM to install the command-line client.

Step 1: Install Node.js

Visit http://www.nodejs.org and pick an installation package that is suitable for your operating system. Run the installer and pick all the default options. You're all set!

Step 2: Install the Cloud CMS command-line client

Once Node.js has been installed, you should open up a terminal window to drop into the command line. And then run,

npm install cloudcms-cli -g

Step 3: Connect to Cloud CMS

You should now connect your Cloud CMS tenant. Run the following:

cloudcms init

And walk through the prompts. You will be asked for the URL to your UI server. If you're connecting to a trial account, this will be something like https://mytenant.cloudcms.net. For the API server, you can put https://api.cloudcms.com.

If you're connecting to a locally installed Cloud CMS environment that uses the Docker samples that we provide, the UI server will typically be http://localhost and the API server may be http://localhost:8080.

If you're otherwise connecting to an on-premise or self-hosted instance of Cloud CMS, please check with your system administrator for information about the URLs to use for the UI and API servers.

To get your Cloud CMS client keys and login credentials,
   visit "https://www.cloudcms.com".

Enter the URL to your Cloud CMS UI endpoint: https://mytenant.cloudcms.net
Enter the URL to your Cloud CMS API endpoint: https://api.cloudcms.com
Enter your username: myUsername
Enter your password: myPassword

Testing connectivity...
Successfully connected to Cloud CMS!

Cloud CMS platform connection credentials were saved to:
   /Users/username/.cloudcms/credentials.json

You can also invoke this using switches, like this:

cloudcms init --ui https://mytenant.cloudcms.net --api https://api.cloudcms.com --username myUsername --password myPassword

Usage

In general, you run the command line tool like this:

cloudcms <command> [switches]

Many commands are also grouped. Grouped commands work like this:

cloudcms <group> <command> [switches]

Switches are either key/value pairs or booleans. Key/value pairs are specified in the form --<key> <value>. Booleans are simply specified as --<key>.

To see the list of commands, simply type:

cloudcms

You can then pull up commands for a group, like this:

cloudcms <group>

To pull up information about a specific command, use the --help switch.

cloudcms <command> --help
cloudcms <group> <command> --help

To see the version of the command line tool:

cloudcms --version

Examples

Here are a few examples of how the tool is used.

Query for Nodes on a branch

Find all content where the rating is greater than 3:

cloudcms branch query --repository 7d18d8bafa6923e6d126 --branch 2b2fac2fdb6ae406fe8f --query "{'rating': { '$gt': 3 }}"

Find all content where the rating is greater than 3 and hand back 25 items starting while sorting by customer.name ascending and format things to be readable:

cloudcms branch query --repository 7d18d8bafa6923e6d126 --branch 2b2fac2fdb6ae406fe8f --query "{'rating': { '$gt': 3 }}" --limit 50 --sort "{'customer.name': -1}" --pretty

Find all content where rating is less than 5 and limit the response so that we only get back the title and customer fields:

cloudcms branch query --repository 7d18d8bafa6923e6d126 --branch 2b2fac2fdb6ae406fe8f --query "{'rating': { '$lt': 5 }}" --fields "{'title': 1, 'customer': 1}" --pretty

Search for Nodes

Find all content where the word hello appears in the text:

cloudcms branch search --repository 7d18d8bafa6923e6d126 --branch 2b2fac2fdb6ae406fe8f --text "hello"

Find all content where the word hello appears and hand back 50 items starting at the 100th entry while sorting by title descending and format things to be readable:

cloudcms branch search --repository 7d18d8bafa6923e6d126 --branch 2b2fac2fdb6ae406fe8f --text "hello" --limit 50 --skip 100 --sort "{'title': -1}" --pretty

Commands Reference

init

Initializes your command line client's connection to Cloud CMS

Usage

Name Required Type Switches Description
ui required string --ui The URL to your Cloud CMS UI endpoint (example: https://mytenant.cloudcms.net or http://localhost)
api required string --api, --a The URL to your Cloud CMS API endpoint (example: https://api.cloudcms.com or http://localhost:8080)
username required string --username, --user, --name, --u Your Cloud CMS user name
password required string --password, --pass, --pw, --p Your Cloud CMS password

Example

cloudcms init  --ui <ui> --api <api> --username <username> --password <password>

admin

Admin Commands

inspect-datastore

Inspects a datastore

Usage

Name Required Type Switches Description
datastoreTypeId required string --datastoreTypeId, --type Enter the data store type ID
datastoreId required string --datastoreId, --id Enter the data store ID
username required string --username, --u Admin username
password required string --password, --p Admin password

Example

cloudcms admin inspect-datastore  --datastoreTypeId <datastoreTypeId> --datastoreId <datastoreId> --username <username> --password <password>

list-environments

Lists the datastore environments

Usage

Name Required Type Switches Description
username required string --username, --u Admin username
password required string --password, --p Admin password

Example

cloudcms admin list-environments  --username <username> --password <password>

migrate-datastore

Migrates a datastore from one environment to another

Usage

Name Required Type Switches Description
datastoreTypeId required string --datastoreTypeId, --type Enter the data store type ID
datastoreId required string --datastoreId, --id Enter the data store ID
sourceEnvironmentId required string --sourceEnvironmentId, --sourceEnv Enter the source environment ID
targetEnvironmentId required string --targetEnvironmentId, --targetEnv Enter the target environment ID
targetDatastoreId string --targetDatastoreId, --targetId Enter the target data store ID
deleteSourceDatastore boolean --deleteSourceDatastore, --delete Delete the source data store after migration completes?
swapStack boolean --swapStack, --swap Swap the new datastore into stack (replacing the old one)?
overwrite boolean --overwrite Overwrite the target?
username required string --username, --u Admin username
password required string --password, --p Admin password

Example

cloudcms admin migrate-datastore  --datastoreTypeId <datastoreTypeId> --datastoreId <datastoreId> --sourceEnvironmentId <sourceEnvironmentId> --targetEnvironmentId <targetEnvironmentId> [--targetDatastoreId <targetDatastoreId>] [--deleteSourceDatastore] [--swapStack] [--overwrite] --username <username> --password <password>

rebuild-branch-view

Rebuilds a view for a branch

Usage

Name Required Type Switches Description
repositoryId required string --repository, --r Enter the repository ID
branchId required string --branch, --b Enter the branch ID
username required string --username, --u Admin username
password required string --password, --p Admin password

Example

cloudcms admin rebuild-branch-view  --repository <repositoryId> --branch <branchId> --username <username> --password <password>

reindex-datastore

Rebuilds MongoDB indexes for a datastore

Usage

Name Required Type Switches Description
datastoreTypeId required string --datastoreTypeId, --type Enter the data store type ID
datastoreId required string --datastoreId, --id Enter the data store ID
children boolean --children, --c Whether to index any child data stores as well
username required string --username, --u Admin username
password required string --password, --p Admin password

Example

cloudcms admin reindex-datastore  --datastoreTypeId <datastoreTypeId> --datastoreId <datastoreId> [--children] --username <username> --password <password>

repair-branch

Runs repair operations over a branch to ensure any inconsistencies are cleaned up

Usage

Name Required Type Switches Description
repositoryId required string --repository, --r Enter the repository ID
branchId required string --branch, --b Enter the branch ID
username required string --username, --u Admin username
password required string --password, --p Admin password
commit boolean --commit Commit Repairs?

Example

cloudcms admin repair-branch  --repository <repositoryId> --branch <branchId> --username <username> --password <password> [--commit]

application

Application Commands

download-api-keys

Download the API Keys for an application deployment

Usage

Name Required Type Switches Description
applicationId required string --application, --app, --a The ID of the application where the branch lives
deploymentKey string --deployment, --d The deployment key
out string --out, --o The output file path

Example

cloudcms application download-api-keys  --application <applicationId> [--deployment <deploymentKey>] [--out <out>]

archive

Archive Commands

download

Download an Archive

Usage

Name Required Type Switches Description
group required string --group, --g The group ID of the archive that should be downloaded
artifact required string --artifact, --a The artifact ID of the archive that should be downloaded
version required string --version, --v The version of the archive that should be downloaded

Example

cloudcms archive download  --group <group> --artifact <artifact> --version <version>

upload

Upload an Archive

Usage

Name Required Type Switches Description
group required string --group, --g The group ID of the archive that should be created after upload
artifact required string --artifact, --a The artifact ID of the archive that should be created after upload
version required string --version, --v The version of the archive that should be created after upload

Example

cloudcms archive upload  --group <group> --artifact <artifact> --version <version>

branch

Branch Commands

export

Exports a branch to an archive

Usage

Name Required Type Switches Description
repositoryId required string --repository, --r The ID of the repository where the branch lives
branchId string --branch, --b The ID of the branch
group required string --group, --g The group ID of the archive that should be exported
artifact required string --artifact, --a The artifact ID of the archive that should be exported
version required string --version, --v The version of the archive that should be exported

Example

cloudcms branch export  --repository <repositoryId> [--branch <branchId>] --group <group> --artifact <artifact> --version <version>

import

Imports an archive into a branch

Usage

Name Required Type Switches Description
group required string --group, --g The group ID of the archive that should be imported
artifact required string --artifact, --a The artifact ID of the archive that should be imported
version required string --version, --v The version of the archive that should be imported
repositoryId required string --repository, --r The ID of the Repository where the target Branch lives
branchId required string --branch, --b The ID of the target Branch

Example

cloudcms branch import  --group <group> --artifact <artifact> --version <version> --repository <repositoryId> --branch <branchId>

query

Queries for Nodes on a Branch

Usage

Name Required Type Switches Description
repositoryId required string --repository, --r Enter the repository ID
branchId required string --branch, --b Enter the branch ID
query string --query, --q Enter the query JSON
skip number --skip, --s Enter the pagination skip
limit number --limit, --l Enter the pagination limit
sort string --sort, --x Enter the pagination sort JSON
fields string --fields, --f Enter the fields JSON

Example

cloudcms branch query  --repository <repositoryId> --branch <branchId> [--query <query>] [--skip <skip>] [--limit <limit>] [--sort <sort>] [--fields <fields>]

read

Reads a branch

Usage

Name Required Type Switches Description
repositoryId required string --repository, --r Enter the repository ID
branchId required string --branch, --b Enter the branch ID
metadata boolean --metadata, --m Whether to hand back system metadata

Example

cloudcms branch read  --repository <repositoryId> --branch <branchId> [--metadata]

Searches for Nodes on a Branch

Usage

Name Required Type Switches Description
repositoryId required string --repository, --r Enter the repository ID
branchId required string --branch, --b Enter the branch ID
query string --query, --q Enter the query JSON
text string --text, --t Enter the text to search for
skip number --skip, --s Enter the pagination skip
limit number --limit, --l Enter the pagination limit
sort string --sort, --x Enter the pagination sort JSON

Example

cloudcms branch search  --repository <repositoryId> --branch <branchId> [--query <query>] [--text <text>] [--skip <skip>] [--limit <limit>] [--sort <sort>]

datastore

Data Store Commands

get-value

Gets a key/value from a datastore

Usage

Name Required Type Switches Description
datastoreTypeId required string --type The type of the data store
datastoreId required string --id The ID of the data store
key required string --key, --k The key to retrieve

Example

cloudcms datastore get-value  --type <datastoreTypeId> --id <datastoreId> --key <key>

read

Reads a datastore

Usage

Name Required Type Switches Description
datastoreTypeId required string --type The type of the data store
datastoreId required string --id The ID of the data store
metadata boolean --metadata, --m Whether to hand back system metadata

Example

cloudcms datastore read  --type <datastoreTypeId> --id <datastoreId> [--metadata]

remove-value

Remove a key/value from a datastore

Usage

Name Required Type Switches Description
datastoreTypeId required string --type The type of the data store
datastoreId required string --id The ID of the data store
key required string --key, --k The key to retrieve

Example

cloudcms datastore remove-value  --type <datastoreTypeId> --id <datastoreId> --key <key>

set-value

Sets a key/value onto a datastore

Usage

Name Required Type Switches Description
datastoreTypeId required string --type The type of the data store
datastoreId required string --id The ID of the data store
key required string --key, --k The key to retrieve
value required string --value, --val, --v The value to set
bool boolean --boolean, --bool Whether the value is true/false
int boolean --integer, --int Whether the value is an integer

Example

cloudcms datastore set-value  --type <datastoreTypeId> --id <datastoreId> --key <key> --value <value> [--boolean] [--integer]

hosting

Hosted Application Commands

deploy

Deploys an Application to hosting target

Usage

Name Required Type Switches Description
applicationId required string --application, --a The ID of the application
deploymentKey string --deployment, --d The deployment key

Example

cloudcms hosting deploy  --application <applicationId> [--deployment <deploymentKey>]

info

Retrieve info about an Application deployment against a hosting target

Usage

Name Required Type Switches Description
applicationId required string --application, --a The ID of the application
deploymentKey string --deployment, --d The deployment key

Example

cloudcms hosting info  --application <applicationId> [--deployment <deploymentKey>]

open

Opens the application deployment URL

Usage

Name Required Type Switches Description
applicationId required string --application, --a The ID of the application
deploymentKey string --deployment, --d The deployment key

Example

cloudcms hosting open  --application <applicationId> [--deployment <deploymentKey>]

start

Starts the deployed application

Usage

Name Required Type Switches Description
applicationId required string --application, --a The ID of the application
deploymentKey string --deployment, --d The deployment key

Example

cloudcms hosting start  --application <applicationId> [--deployment <deploymentKey>]

start

Restarts the deployed application

Usage

Name Required Type Switches Description
applicationId required string --application, --a The ID of the application
deploymentKey string --deployment, --d The deployment key

Example

cloudcms hosting start  --application <applicationId> [--deployment <deploymentKey>]

stop

Stops the deployed application

Usage

Name Required Type Switches Description
applicationId required string --application, --a The ID of the application
deploymentKey string --deployment, --d The deployment key

Example

cloudcms hosting stop  --application <applicationId> [--deployment <deploymentKey>]

undeploy

Undeploys an Application from its hosting target

Usage

Name Required Type Switches Description
applicationId required string --application, --a The ID of the application
deploymentKey string --deployment, --d The deployment key

Example

cloudcms hosting undeploy  --application <applicationId> [--deployment <deploymentKey>]

latency

Latency Commands

api

Tests Latency to your Cloud CMS API Server

Usage

Name Required Type Switches Description
url string --url, --u Enter the URL of the Cloud CMS API Server:

Example

cloudcms latency api  [--url <url>]

server

Tests latency to any HTTP server

Usage

Name Required Type Switches Description
url required string --url, --u Enter the URL to execute against:

Example

cloudcms latency server  --url <url>

ui

Tests Latency to your Cloud CMS UI Server

Usage

Name Required Type Switches Description
url string --url, --u Enter the URL of the Cloud CMS UI Server:

Example

cloudcms latency ui  [--url <url>]

module

Module Commands

deploy

Deploys a Module

Usage

Name Required Type Switches Description
id required string --id Enter the module ID

Example

cloudcms module deploy  --id <id>

list

Lists the Modules

Example

cloudcms module list

redeploy

Redeploys a Module

Usage

Name Required Type Switches Description
id required string --id Enter the module ID

Example

cloudcms module redeploy  --id <id>

register

Registers a Module

Usage

Name Required Type Switches Description
id required string --id Enter the module ID
sourceType required string --sourceType, --type Enter the module source type
sourceUrl required string --sourceUrl, --url Enter the module source URL
sourcePath string --sourcePath, --path Enter the module source path
sourceBranch string --sourceBranch, --branch Enter the module source branch

Example

cloudcms module register  --id <id> --sourceType <sourceType> --sourceUrl <sourceUrl> [--sourcePath <sourcePath>] [--sourceBranch <sourceBranch>]

undeploy

Undeploys a Module

Usage

Name Required Type Switches Description
id required string --id Enter the module ID

Example

cloudcms module undeploy  --id <id>

unregister

Unregisters a Module

Usage

Name Required Type Switches Description
id required string --id Enter the module ID

Example

cloudcms module unregister  --id <id>

platform

Platform Commands

list-applications

Lists Applications

Usage

Name Required Type Switches Description
skip number --skip, --s Enter the pagination skip
limit number --limit, --l Enter the pagination limit
sort string --sort, --x Enter the pagination sort JSON

Example

cloudcms platform list-applications  [--skip <skip>] [--limit <limit>] [--sort <sort>]

list-projects

Lists Projects

Usage

Name Required Type Switches Description
skip number --skip, --s Enter the pagination skip
limit number --limit, --l Enter the pagination limit
sort string --sort, --x Enter the pagination sort JSON

Example

cloudcms platform list-projects  [--skip <skip>] [--limit <limit>] [--sort <sort>]

query-applications

Queries for Applications

Usage

Name Required Type Switches Description
query string --query, --q Enter the query JSON
skip number --skip, --s Enter the pagination skip
limit number --limit, --l Enter the pagination limit
sort string --sort, --x Enter the pagination sort JSON

Example

cloudcms platform query-applications  [--query <query>] [--skip <skip>] [--limit <limit>] [--sort <sort>]

query-projects

Queries for Projects

Usage

Name Required Type Switches Description
query string --query, --q Enter the query JSON
skip number --skip, --s Enter the pagination skip
limit number --limit, --l Enter the pagination limit
sort string --sort, --x Enter the pagination sort JSON

Example

cloudcms platform query-projects  [--query <query>] [--skip <skip>] [--limit <limit>] [--sort <sort>]

project

Project Commands

export

Exports a project to an archive

Usage

Name Required Type Switches Description
projectId required string --projectId, --project, --id The ID of the project
group required string --group, --g The group ID of the archive that should be exported
artifact required string --artifact, --a The artifact ID of the archive that should be exported
version required string --version, --v The version of the archive that should be exported

Example

cloudcms project export  --projectId <projectId> --group <group> --artifact <artifact> --version <version>

sample

Sample Project Commands

connect

Connects to the Sample Project application and downloads a gitana.json file

Usage

Name Required Type Switches Description
out string --out, --o The output file path

Example

cloudcms sample connect  [--out <out>]

server

Server Commands

start

Starts the Application Server

Example

cloudcms server start