cs-icon.svg

Apps CLI Plugin

Contentstack lets you develop apps in your organization using the Developer Hub portal. With the Apps CLI plugin, Contentstack CLI allows you to perform the CRUD operations on your app in Developer Hub and then use the app in your organization or stack by installing or uninstalling your app as required.

This step-by-step guide lets you install and use the Apps CLI plugin in CLI.

Prerequisites

Install the Apps CLI Plugin

Install the Apps CLI plugin using the following command:

csdx plugins:install @contentstack/apps-cli

Commands

The Apps CLI Plugin lets you perform the following operations in Contentstack CLI:

Create an app

The app:create command allows you to create or register an app in Developer Hub and optionally clone a boilerplate locally.

  1. Open a terminal.
  2. Fire the following command:
    csdx app:create
    
  3. Enter a name for your app.
  4. Select an organization.
  5. In the prompt that appears, select Y if you want to fetch the app template from GitHub. Else select n.
    Apps-CLI_Create_Prompt
    You have successfully created an app in Developer Hub.
    Alternatively, you can pass the name and organization UID in the command as given below:
    csdx app:create --name <app_name> --org <organization uid>
    

Usage

csdx app:create

Options

  • -c, --config=config: [optional] Path of the external config.
  • -d, --data-dir=data-dir: [optional] Current working directory.
  • -n, --name=name: [default: app-boilerplate] Name of the app to be created.
  • --app-type: [default: stack] Type of app <options: stack|organization>.
  • --org: Provide the organization UID to fetch the app details for the operation.

Examples

  • To create a stack app named App-1:
    csdx app:create --name App-1 --app-type stack
    
  • To create an organization app named App-3 by providing the current working directory and the path of the external config:
    csdx app:create --name App-3 --app-type organization --org <UID> -d ./boilerplate -c ./external-config.json
    

Get app details

The app:get command allows you to get the details of an app in Developer Hub.

  1. Open a terminal.
  2. Fire the following command:
    csdx app:get
    
  3. Select the organization which has the app whose details are to be fetched.
  4. Select the app from the displayed list.
    You receive the fetched app data in the manifest.json file in your folder.

Usage

csdx app:get

Options

  • -d, --data-dir=data-dir: [optional] Current working directory.
  • --app-type: [default: stack] Type of app <options: stack|organization>.
  • --app-uid: Provide the app UID of an existing app.
  • --org: Provide the organization UID to fetch the app details for the operation.

Examples

  • To fetch the details of a stack app:
    csdx app:get --org <value> --app-uid <value> --app-type stack
    
  • To fetch the details of an organization app:
    csdx app:get --org <value> --app-uid <value> --app-type organization
    

Install an app

The app:install command allows you to install an app from Developer Hub to an organization or a stack.

  1. Open a terminal.
  2. Fire the following command to install an app:
    csdx app:install
    
  3. Select an organization from the displayed list.
  4. Select the app you want to install.
  5. If you selected a Stack App, select a stack where you want to install the app.
    You have successfully installed the app.
    Alternatively, you can pass the app UID and the organization UID in the command as given below:
    csdx app:install --app-uid <app_uid> --org <org_uid>
    

Usage

csdx app:install

Options

  • --org: Provide the organization UID to fetch the app details for the operation.
  • --app-uid: Provide the app UID of an existing app.
  • --stack-api-key: API Key of the stack where the app operation is to be performed.

Examples

  • To install an app:
    csdx app:install
    
  • To install an app by providing the stack where the app is to be installed:
    csdx app:install --stack-api-key
    

Update an app

The app:update command allows you to update an existing app in Developer Hub.

  1. Make the required app updates in the app manifest.json file.
  2. Open a terminal.
  3. Fire the following command to update the app in the UI with respect to the app manifest.json file:
    csdx app:update
    
  4. Select an organization from the displayed list.
  5. Enter the path to the app manifest.json file.
  6. Select the app you want to update.
    You have successfully updated the app.
    Alternatively, you can pass the app manifest.json file path in the command as given below:
    csdx app:update --app-manifest <file_path>
    

Usage

csdx app:update

Options

  • --app-manifest: Path to the app manifest.json file.
  • --org: Provide the organization UID to fetch the app details for the operation.

Examples

  • To update an app for a provided app manifest file:
    csdx app:update --app-manifest <value>
    

Reinstall an app

The app:reinstall command allows you to reinstall an app from Developer Hub to an organization or a stack.

  1. Open a terminal.
  2. Fire the following command to reinstall an app:
    csdx app:reinstall
    
  3. Select an organization from the displayed list.
  4. Select the app you want to reinstall.
  5. If you selected a Stack App, select a stack where you want to reinstall the app.
    You have successfully reinstalled the app.
    Alternatively, you can pass the app UID and the organization UID in the command as given below:
    csdx app:reinstall --app-uid <app_uid> --org <org_uid>
    

Usage

csdx app:reinstall

Options

  • --org: Provide the organization UID to fetch the app details for the operation.
  • --app-uid: Provide the app UID of an existing app.
  • --stack-api-key: API Key of the stack where the app operation is to be performed.

Examples

  • To reinstall an app:
    csdx app:reinstall
    
  • To reinstall an app by providing the stack where the app is to be reinstalled:
    csdx app:reinstall --stack-api-key
    

Uninstall an app

The app:uninstall command allows you to uninstall an app from the organization or stack.

  1. Open a terminal.
  2. Fire the following command to uninstall an app:
    csdx app:uninstall
    
  3. Select the organization which has the app you want to uninstall.
  4. Select the app you want to uninstall.
  5. If you selected a Stack App, select the stack(s) from where you want to uninstall the app.
    You have successfully uninstalled the app.
    Alternatively, you can pass the app UID and the organization UID in the command as given below:
    csdx app:uninstall --app-uid <app_uid> --org <org_uid>
    

Usage

csdx app:uninstall

Options

  • --org: Provide the organization UID to fetch the app details for the operation.
  • --app-uid: Provide the app UID of an existing app.
  • --installation-uid: Provide the installation ID of the app that needs to be uninstalled.
  • --uninstall-all: Uninstalls the app from all the stacks where it is installed.

Examples

  • To uninstall an organization app:
    csdx app:uninstall --org <UID> --app-uid <APP-UID-1>
    
  • To uninstall an organization app from all the stacks where it is installed:
    csdx app:uninstall --org <UID> --app-uid <APP-UID-1> --uninstall-all
    
  • To uninstall an organization app for a given installation ID:
    csdx app:uninstall --org <UID> --app-uid <APP-UID-1> --installation-uid <INSTALLATION-UID-1>
    

Delete an app

The app:delete command allows you to delete an app from Developer Hub.

Note: If you want to delete an installed app, uninstall the app first and then perform the delete operation.

  1. Open a terminal.
  2. Fire the following command to delete an app:
    csdx app:delete
    
  3. Select an organization from the displayed list.
  4. Select the app you want to delete.
    You have successfully deleted the app.
    Alternatively, you can pass the app UID and the organization UID in the command as given below:
    csdx app:delete --app-uid <app_uid> --org <org_uid>
    

Usage

csdx app:delete

Options

  • --org: Provide the organization UID to fetch the app details for the operation.
  • --app-uid: Provide the app UID of an existing app.

Examples

  • To delete an app for a given app UID:
    csdx app:delete --app-uid <value>
    
  • To delete an organization app for a given app UID:
    csdx app:delete --app-uid <value> --org <value>
    

Limitation

  • If a stack with an installed app gets deleted, you cannot uninstall or delete the app from the organization. Please contact the support team for the next steps.
Was this article helpful?
^