loading

apply

Applies configuration stored in the source directory to the account that the current credential is pointing to.

Usage

yext resources apply [SOURCE-DIR] [flags]

Flags

Flag Description
-h, --help Help for resources apply
-d, --dry Validate and view the result of an apply operation without persisting changes
-f, --force Force apply resources without a confirmation prompt
--namespace strings List of namespaces that should be affected. Any resources outside of the listed namespaces will not be applied. See examples below.


Example usage of --name flag

If you are trying to:

  • Apply resources in myFolder that are in the default namespace, run:

    yext resources apply myFolder --namespace default
  • Apply resources in myFolder that are in the default namespace OR myNamespace

    yext resources apply myFolder --namespace default,myNamespace

apply API

Property Type Default Description
-d, --dry
Validate and view the result of an apply operation without persisting changes
--namespace strings
List of namespaces that should be affected. Any resources outside of the listed namespaces will not be applied.

diff

Displays the differences between your local version of resources and your resources stored in Yext. This is powerful for operations where you want to review the changes before they are applied.

Usage

yext resources diff [SOURCE-DIR] [flags]

Flags

Flag Description
-h, --help Help for resources diff


Prerequisites

You must have Git installed in order to run this command. If Git is not installed, please follow the instructions (on the Git website)[https://git-scm.com/book/en/v2/Getting-Started-Installing-Git] before running this command.

pull

Pulls/fetches configuration from Yext and stores them in code files at the specified destination directory. Files are pulled from the Yext account specified by the current credential.

Usage

yext resources pull [DESTINATION-DIR] [flags]

Flags

Flag Description
-h, --help Help for resources pull
--name strings List of resource names. If this is included, only resources with the specified names are returned. Resources are specified with their full id including namespace. See examples below.
--namespace strings List of namespaces. If this is included, only resources in the listed namespaces are returned. See examples below.
--type strings List of resource types. If this is included, only resources of the listed types will be returned. A resource type is specified by the path after https://schema.yext.com/config/ in the $schema field of its Config as Code JSON schema definition. JSON schema definitions can be found here.
--exclude strings List of resource types to exclude. If this is included, the resources of the listed types will be excluded. A resource type is specified by the path after https://schema.yext.com/config/ in the $schema field of its Config as Code JSON schema definition. JSON schema definitions can be found here.
--organize-by-resource-type Organize the pulled resources by resource type, as opposed to organize by namespace. See examples below.


Example usage of --name flag

If you are trying to:

  • Pull resource called myResource in the default namespace to myFolder, run:

    yext resources pull myFolder --name myResource
  • Pull resource called myResource in the namespace myNamespace to myFolder, run:

    yext resources pull myFolder --name myNamespace_myResource
  • Pull resources called myResource1 and myResource2 in the default namespace to myFolder, run:

    yext resources pull myFolder --name myResource1,myResource2


Example usage of --namespace flag

If you are trying to:

  • Pull resources in the default namespace to myFolder, run:

    yext resources pull myFolder --namespace default
  • Pull resources in the default namespace and myNamespace to myFolder, run:

    yext resources pull myFolder --namespace default,myNamespace


Example usage of --type Flag

  • Pull all entity-type resources to myFolder, run:

    yext resources pull myFolder --type km/entity-type 
  • Pull all entity-type resources and all role resources to myFolder, run:

    yext resources pull myFolder --type km/entity-type,platform/role

Example usage of --exclude Flag

  • Pull all resources except km/entity to myFolder, run:

    yext resources pull myFolder --exclude km/entity 
  • Pull all resources except entity-type and role resources to myFolder, run:

    yext resources pull myFolder --exclude km/entity-type,platform/role


Example usage of --organize-by-resource-type Flag

  • Pull resources and organize by resource type, run: cli yext resources pull myFolder --organize-by-resource-type

copy

Applies configurations stored in the source account to the destination account.

Notable operations the copy command does:

  1. Pulls dependencies.json from source account and applies to the destination account (if destination account is a non-production account).
  2. Pulls with pages-force-template true and then edits the pages/site-config JSONs by copying value at JSON path /repoConfig/templateRepo to /repoConfig/targetRepoName
  3. Edits the km/entity config JSONs by removing JSON paths /content/googleAttributes and /content/categoryIds

Usage

yext resources copy [flags]

Flags

Flag Description
-h, --help Help for resources copy