1

We have a requirement to serialize content hub pages and got that we can do with Sitecore Content Hub CLI. Need some starting point for how to setup it for the content hub and how to achieve this. Also, suggest if we can use anything else for the same.

2 Answers 2

0

With the CLI, you can manage content and media from a Content Hub instance. The CLI uses the SDK to communicate with Content Hub instances through the API, based on commands in the form of lines of text.

Before you can use the Content Hub CLI, you must:

  1. Install and Run CLI
  2. Login with the CLI

Read the Sitecore official document to setup.

https://doc.sitecore.com/ch/en/developers/42/cloud-dev/integration-tools--content-hub-cli.html

Hope this helps.

0

Before you begin, ensure, you review the prerequisites and initialize your working folder. (Link)

To use the Content Hub CLI, ensure you have the following installed:

These are the most common commands that you’ll use when working with the Content Hub CLI to help you get started in no time.

  1. Common CLI commands

    You can run the Sitecore Content Hub CLI from any PowerShell or Command Prompt, or directly from the terminal in Visual Studio Code, by calling:

    ch-cli

    To get an overview of all available commands, you can call:

    ch-cli -?

    You can to do the same for individual commands to get more information on that command, for example:

    ch-cli serialization -?

  2. Setup endpoints

    Add an endpoint to connect to a Content Hub instance:

    ch-cli endpoint add --name dev-test --url https://<YOUR-SANDBOX-NAME>.sitecoresandbox.cloud/ --client-id CLI --client-secret <YOUR-CLIENT-SECRET>

    Set an endpoint to active:

    ch-cli endpoint select -n dev-test

    Refresh the token for an endpoint (this will prompt you to login):

    ch-cli endpoint refresh

  3. Pulling resources

    Pull all entity definitions (including taxonomy definitions):

    ch-cli serialization pull ed

    Pull all option lists:

    ch-cli serialization pull ol

    Pull all entities:

    ch-cli serialization pull ent

    Pull a specific entity definition (in this case, for M.Asset):

    ch-cli serialization pull ed -n M.Asset

  4. Pushing resources

    Push a entity definition (or taxonomy definition, in this case EtB.TestTaxonomy) to the connected instance:

    ch-cli serialization push entity-definition --name EtB.TestTaxonomy

    Note: This command requires the Free Modelling license. If you don’t have Free Modelling enabled, you will get an error: “[Error] At least one of these privileges (ModifyTaxonomyDefinitions) is required to perform the modify action on EtB.TestTaxonomy”

Hopefully, this overview is helpful for you to quickly get started using the Content Hub CLI. For more information on each individual command, please refer to the official Sitecore documentation.

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.