OCP CLI command reference
Reference for the Optimizely Connect Platform (OCP) command-line interface (CLI), including commands, namespaces, flags, and options.
This page lists every available Optimizely Connect Platform (OCP) command-line interface (CLI) command, with parameters, flags, and options. To install and configure the OCP CLI, see Configure your OCP development environment.
OCP CLI help command
Commands are grouped into namespaces.
$ ocp -h
Usage: ocp <command>
Namespaces: (`<namespace>` -h, --help for additional help)
accounts
app
availability
dev-server
directory
env
jobs
review
Commands:
autocomplete Display autocomplete installation instructions
dev Start the local development server for OCP apps
update Update the OCP CLIRun the help command, -h or --help, to list commands in a namespace. See the following example:
$ ocp app -h
Usage: ocp app <command>
Commands:
init Create a new app project
logs Fetch app logs
package Prepare a package for manual upload
prepare Validate, package, upload and build an app to prepare for publishing
register Register an app version
validate Validate an app locally
ocp <command> -h, --help for help on specific commandsAdding the help context on a command displays documentation for the command with all available options. See the following example:
$ ocp app prepare -h
Usage: ocp app prepare [<path>] [--noProgress | --no-progress] [--upgradeDeps | --upgrade-deps] [--publish] [--usePreviousAppEnvValues | --use-previous-app-env-values] [--bumpDevVersion | --bump-dev-version]
Parameters:
path The root directory of the app
Flags:
--noProgress, --no-progress Don't display any progress indicators
--upgradeDeps, --upgrade-deps Automatically update dependencies
--publish Automatically publish if the upload is successful
--usePreviousAppEnvValues Use app env values (.env file) from the previous version of the app.
Any values in local .env file are ignored
--bumpDevVersion Bump dev version before building. Allows quickly testing dev versionsOCP CLI commands
The following table lists all available OCP CLI commands with their parameters and descriptions:
| Command | Parameters | Description |
|---|---|---|
ocp -h | N/A | The help context for the OCP CLI is -h. It provides information about your environment when you run ocp -h and provides contextual help when you add -h after any command. |
ocp -v or ocp --version | N/A | Displays the installed OCP CLI version. |
ocp autocomplete | N/A | Displays shell autocompletion installation instructions. Supports Bash, Zsh, and PowerShell, with PowerShell 7+ for Windows. Run the command and follow the instructions provided in the terminal. |
ocp update | N/A | Updates the OCP CLI to the latest version. You can append --available to display the list of available versions. |
ocp accounts whoami | N/A | Returns your account information. |
ocp accounts whois | <user> | Returns basic account information for a specific user. Requires a user input, for example, ocp accounts whois "user". |
ocp app init | <appId> | Creates a new app project and initializes the app. Requires the app ID, for example, ocp app init <appId>. |
ocp app logs | <appId> or <buildId> | Returns app logs. Requires the app ID or build ID, for example, ocp app logs <buildId>. See additional flags and options. |
ocp app getLogLevel or ocp app get-log-level | <appId@appVersion> | Returns the log level for the app version that you specify. Requires the app ID and version in the following format: <appId@appVersion>. See additional flags and options. |
ocp app setLogLevel or ocp app set-log-level | <appId@appVersion> <logLevel> | Sets the log level for the app version that you specify. Options are debug, info, warn, error, never. Requires the app ID and version in the following format: <appId@appVersion>. See additional flags and options. |
ocp app package | <path> | Prepares a package for manual upload. Requires the path for the root directory of the app, for example, ocp app package <path>. |
ocp app prepare | <path> | Validates, packages, uploads, and builds an app to prepare for publishing. Requires the path for the root directory of the app, for example, ocp app prepare <path>. See additional flags and options. |
ocp app register | <id> <name> | Registers an app version. Requires the app ID and name, for example, ocp app register <id> <name>. You can append --availability or --a to define the availability region to which the app is registered (default is US). |
ocp app validate | <path> | Validates an app locally. Requires the path for the root directory of the app, for example, ocp app validate <path>. See additional flags and options. |
ocp app abandon | <appId@appVersion> | Ceases the processing of the specified app version that you have not published yet. You can append --noPrompt or --no-prompt to use the default answer (yes) to any prompt question, except for destructive operations. For example, ocp app abandon <appId@appVersion>. |
ocp availability list | N/A | Lists all availability regions (US, EU, AU). |
ocp dev | N/A | Starts the local development server for OCP apps. This is a quick-start command. For more configuration options, use ocp dev-server start. |
ocp dev-server start | N/A | Starts the local development server with configuration options. Optionally specify the path to the OCP app root directory. See additional flags and options. |
ocp directory unpublish | <appId@appVersion> | Unpublishes an app version (uninstalls everywhere and undeploys). Requires the app ID and version in the following format: <appId@appVersion>. For example, ocp directory unpublish <appId@appVersion>. See additional flags and options. |
ocp directory publish | <appId@appVersion> | Publishes (makes available) a specific app version that has been reviewed and approved. Requires the app ID and version in the following format: <appId@appVersion>. For example, ocp directory publish <appId@appVersion>. You can append --noProgress or --no-progress. |
ocp directory info | <appId> | Gets information about an app. Requires the app ID, for example, ocp directory info <appId>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory install | <appId@appVersion> <trackerId> | Installs a specific app version into an account. Requires the app ID and version (in the following format: <appId@appVersion>), and the tracker ID of the account to which you want to install the app. For example, ocp directory install <appId@appVersion> <trackerId>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory list | <appId> | Lists registered app versions. Lists all apps by default if you do not define the app ID, for example, ocp directory list <appId>. See additional flags and options. |
ocp directory listFunctions or ocp directory list-functions | <appId> <trackerId> | Lists the functions exposed by an app installation. Requires the app ID and tracker ID, for example, ocp directory listFunctions <appId> <trackerId>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory listGlobalFunctions or ocp directory list-global-functions | <appId> | Lists the global functions exposed by an app. Requires the app ID, for example, ocp directory listGlobalFunctions <appId>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory listInstalls or ocp directory list-installs | <appId@appVersion> | Lists installations of a specific app version. Requires the app ID and version (in the following format: <appId@appVersion>). For example, ocp directory listInstalls <appId@appVersion>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory status | <appId@appVersion> | Gets the status of a particular app ID and version. Requires the app ID and version (in the following format: <appId@appVersion>). For example, ocp directory status <appId@appVersion>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory uninstall | <appId> <trackerId> | Uninstalls an app from an account. Requires the app ID and tracker ID, for example, ocp directory uninstall <appId> <trackerId>. You can append --availability or --a to define the availability region of the app (default is US). |
ocp directory upgrade | <appId <trackerId> | Upgrades the install to a specific app version. Requires the app ID and tracker ID, for example, ocp directory upgrade <appId> <trackerId>. See additional flags and options. |
ocp env get | N/A | Gets the current environment of the OCP CLI. |
ocp env set | <env> | Sets the current environment for the OCP CLI. Requires the environment name. |
ocp jobs list | <appId> | Lists jobs. Requires the app ID for which you want to view jobs, for example, ocp jobs list <appId>. See additional flags and options. |
ocp jobs terminate | <jobId> | Terminates a job. Requires the ID of the job to terminate. You can append --availability or --a to define the availability region (default is US). |
ocp jobs trigger | <appId@appVersion> <jobName> <trackerId> | Triggers a job. Requires the app ID and version (in the following format: <appId@appVersion>), job name, and tracker ID of the account for which you want to trigger the job. For example, ocp jobs trigger <appVersion> <jobName> <trackerId>. See additional flags and options. |
ocp review list | <appId> | Lists app versions currently under review. You can optionally define the app ID of the app for which you want to view versions under review (for example, ocp review list <appId>. Lists all apps by default. |
ocp review open | <appId@appVersion> | Opens a review in your browser. Requires the app ID and version (in the following format: <appId@appVersion>). For example, ocp review open <appId@appVersion> |
Additional flags and options for OCP CLI commands
You can append various flags and options for some of the OCP CLI commands.
ocp app logs
--tail– Tails the logs.--appId--buildId--appVersion--trackerId--jobId--installId--from– A start time as an ISO string, an epoch timestamp, or relative string (for example,5mfor 5 minutes). Default is24h.--to– An end time as an ISO string, an epoch timestamp, or relative string (for example,5mfor 5 minutes).--search– String to search for in log messages. Can be specified multiple times.--availabilityor-a– The availability region that is targeted (default isUS).
ocp app getLogLevelorocp app get-log-level
--trackerId– Specific Tracker ID to filter by.--availability– The availability region that is targeted (default isUS).
ocp app setLogLevelorocp app set-log-level
--trackerId– Specific Tracker ID to filter by.--timeToLive– Expiration period for the log level as a relative string (for example,5mfor 5 minutes). Default is 2 hours (2h).--availability– The availability region that is targeted (default isUS).
ocp app prepare
--noProgressor--no-progress– Do not display any progress indicators.--upgradeDepsor--upgrade-deps– Automatically update dependencies.--publish– Automatically publish if the upload is successful.--usePreviousAppEnvValuesor--use-previous-app-env-values– Use app env values (.env file) from the previous version of the app. Any values in the local .env is ignored.--bumpDevVersionor--bump-dev-version– Bump dev version before building. Lets you quickly test dev versions.
ocp app validate
--noProgressor--no-progress– Do not display any progress indicators.--upgradeDepsor--upgrade-deps– Automatically update dependencies.
ocp dev-server start
--portor-p– Port to run the server on (default: 3000).--verboseor-v– Enable verbose logging.--noOpenor--no-open– Do not automatically open the browser.--configor-c– Path to custom configuration file.--path– Path to the OCP app root directory.
ocp directory unpublish
--forceor-f--noProgressor--no-progress--availabilityor-a– The availability region that is targeted (default isUS).
ocp directory publish
--noProgressor--no-progress
ocp directory list
--allStatuses– Includes all statuses. The stopped status is not included by default.--availabilityor-a– The availability region that is targeted (default isUS).
ocp directory upgrade
--toVersionor-v– The desired version (for example, 1.0.0).--availabilityor-a– The availability region that is targeted (default isUS).
ocp jobs list
--version– Specific versions to filter by.--trackerId– Specific Tracker IDs to filter by.--function– Specific job function to filter by.--status– Specific job status to filter by. Possible values include the following:PENDING,SCHEDULED,RUNNING,COMPLETE,ERROR,TERMINATED.--minDuration– Display jobs that were running longer than the given duration (for example,5m= 5 minutes).--sortBy– Column to sort the jobs by. Possible values include the following:id,function,trackerId,status,error,createdAt,triggeredAt,scheduledAt,terminatedAt,updatedAt,duration. The default column to sort by isupdatedAt.--sortDirection– Sort resulting jobs in ascending or descending order. Possible values include the following:ascordesc. The default sort direction isasc.--limit– Number of jobs to list. The default is 50.--columns– Columns to display. Possible values include the following:id,version,function,trackerId,trigger,status,error,createdAt,triggeredAt,scheduledAt,terminatedAt,updatedAt,duration. The default columns areid,version,function,trackerId,status,updatedAt.--from– A start time as an ISO string, an epoch timestamp, or relative string (for example,5m= 5 minutes). The default time value is24h.--to– An end time as an ISO string, an epoch timestamp, or relative string (for example,5m= 5 minutes).--availabilityor-a– The availability region that is targeted (default isUS).
ocp jobs trigger
--parameters– Parameters to pass to the job.--availabilityor-a– The availability region that is targeted (default isUS).
Updated about 2 months ago
