Command-line interface (CLI)

Recontent.app offers a command-line interface (CLI) to interact with your content.

Installation

The recontentapp CLI is available through NPM. To install it, run the following commands:

# Install through NPM
npm install -g @recontentapp/cli

# Update CLI to latest version
npm update -g @recontentapp/cli

# Should output CLI version
recontentapp --version

Configuration

In order to authenticate requests made to the Recontent.app API, define a RECONTENT_API_KEY environment variable. API keys can be generated from your workspace integrations settings.

If you use a self-hosted version of Recontent.app, make sure to also define a RECONTENT_API_URL environment variable (defaults to https://app.recontent.app/public).

Using the CLI

List resources

Prints a table of the most important information about the specified resources.

Arguments:
  resource            projects, languages or workspace

Options:
  -p, --project <id>
  -h, --help          display help for command

List projects:
$ recontentapp get projects

List languages:
$ recontentapp get languages

List languages within a project:
$ recontentapp get languages -p <project_id>

List email templates within a project:
$ recontentapp get email-templates -p <project_id>

Export resources

Downloads phrase translations or email templates and outputs them in a chosen format.

Arguments:
  resource                  phrases, email-template
  id                        Resource ID

Options:
  -p, --project <id>
  -l --languages <id>,<id>  Language IDs
  -f --format <format>      Output format (default: "json")
  -o --output <path>        Output path
  -h, --help                display help for command

Export phrases:
$ recontentapp export phrases -p <project_id> -f json -o './translations/{{ languageName }}{{ fileExtension }}'
$ recontentapp export phrases -p <project_id> -f json -o './{{ languageName }}_{{ languageLocale }}{{ fileExtension }}'

Export all email templates:
$ recontentapp export email-templates -p <project_id> -f html -o './email-templates/{{ key }}/{{ languageName }}{{ fileExtension }}'

Export an email template:
$ recontentapp export email-templates <email_template_id> -f html -o './email-templates/{{ key }}/{{ languageName }}{{ fileExtension }}'
$ recontentapp export email-templates <email_template_id> -f mjml -o './email-templates/{{ key }}-{{ languageName }}{{ fileExtension }}'

Last updated