cs-icon.svg

contentstack-express Command-line Utility

Warning: contentstack-express framework has been deprecated. We will soon stop supporting this framework. Instead, we recommend using DataSync, which is faster and more flexible than the web framework.

The contentstack-express Command-line Utility makes it easy to connect to a stack, synchronize, publish, and unpublish content, as well as create plugins in Contentstack apps.

Note: The contentstack-express framework CLI will soon be deprecated. However, our new CLI has many utilities that will help you manage your Contentstack account from the command line. Check out our CLI documentation for more details and get started with using our new CLI.

Installation

Install contentstack-express Command-line Utility using npm.

To install, run the following command in the terminal/command prompt.

$ npm install -g contentstack-cli

Note: For a global install of “contentstack-cli,” OSX/Linux users may need to prefix the command with sudo.

contentstack-express Command-line Utility commands

Now, let’s look at the commands that are supported by contentstack-express Command-line Utility. To use the options of commands, make sure you are using CLI version 1.0.3 or above.

connect

$ contentstack connect [directory] [api_key] [access_token]

Usage

The connect command is used to connect to an existing stack. Run this command from your favorite location in the command prompt.

Command line options

OptionsDescription
-d, --dirName of the directory where you want the application scaffold to be created
-a, --api_keyStack API key
-c, --tokenStack access token

sync

$ contentstack sync

Usage

The sync command is used to synchronize all the published content locally. Run this command from the project root directory.

Command-line options

OptionsDescription
-e, --envName of the environment of which content needs to be synchronized
-l, --langCode of the language of which the content needs to be synchronized. E.g., en-us
-t, --typeType of content to be synchronized. Type can be

“content_types,” “assets,” or “all.” The default type is “all.”

-c, --content_typesUnique IDs of the content types (comma separated list) of which the content needs to be synchronized
-s, --skip_content_typesUnique IDs of content types (comma separated list) of which the synchronization needs to be skipped
-d, --datetimeISO String format date from where the content synchronization should start. For e.g. 2016-06-03T08:31:46.877Z. If this is left blank, it will sync content from the beginning.
-b, --backupUse this to create a backup of the existing content

publish

$ contentstack publish

Usage

The publish command is used to publish content to the specified environment. Run this command from the project root directory.

Command-line options

OptionsDescription
-u, --usernameEmail id of the Contentstack user
-p, --passwordPassword relevant to the above-mentioned email id
-e, --envName/s of the environments (comma separated list) to which you want to publish the content
-t, --typeType of content to be published. Type can be content_types or assets or all. The default type is “all.”
-l, --langCode of the language to which the content is to be published. For e.g., en-us
-c, --content_typesUnique IDs of the content types (comma separated list) of which the content needs to be published
-s, --skip_content_typesUnique IDs of the content types (comma separated list) the content of which should not be sent for publishing
-b, --backupUse this to create a backup of existing content

unpublish

$ contentstack unpublish

Usage

The unpublish command is used to unpublish content from the specified environment. Run this command from the project root directory.

Command-line options

OptionsDescription
-u, --usernameEmail id of the Contentstack user
-p, --passwordPassword relevant to the above-mentioned email id
-e, --envName/s of the environments(comma separated list) from where the content needs to be unpublished
-t, --typeType of content to be unpublished. Type can be content_types or assets or all. The default type is “all.”
-l, --langCode of the language of which the content needs to be unpublished. E.g., en-us
-c, --content_typesUnique IDs of the content types (comma separated list) of which the content needs to be unpublished
-s, --skip_content_typesUnique IDs of the content types (comma separated list) of which the content should not be unpublished
-b, --backupUse this to create a backup of the existing content

plugin create

$ contentstack plugin create [plugin name]

The plugin create command is used to create a plugin scaffold under the Contentstack application. Check out the documentation on plugin development for more details.

Was this article helpful?
^