Activate Coveo for Sitecore Silently

In some circumstances, for example when creating many Sitecore servers, you will want to silently activate and configure Coveo for Sitecore. This can be done using a REST API to set the different configuration usually entered on the Command Center Activation page.

You can also see the documentation for the provided calls by accessing the Swagger UI available under http://<INSTANCE_HOSTNAME>/coveo/api/config/docs/index.

Swagger UI for Configuration and Activation services

Prerequisites

Available Options

The Swagger endpoint provides the following options:

Configure

The Configure operation is used to set the different values needed for the Coveo for Sitecore configuration, for example the OrganizationId and ApiKey.

Activate

The Activate operation is used to activate Coveo for Sitecore on the Sitecore instance. This will rename the base .example config files that come with Coveo for Sitecore to enable them.

It will also validate that all the values required have been set with Configure previously.

Version

The Version call is available under http://<INSTANCE_HOSTNAME>/coveo/api/config/version and returns that latest version of the API.

This version is used in the URL to call the other operations, for example coveo/api/config/v1/configure. Make sure to always use a specific version in your client implementation to avoid breaking changes in future versions.

Authentication

An authentication needs to be provided using the x-scUsername and x-scPassword headers for each API operations. Only the Version call is exempted from this.

Finding the OrganizationId Value

The OrganizationId can be retrieved in the URL of your Coveo organization.

OrganizationId shown in the URL of your Coveo organization

Creating an Organization

If you don’t have access to an existing organization, you can create a trial organization through the Platform API.

Important

You need to specify the organization template for a Coveo for Sitecore trial, here are the options:

  • SitecoreCloudProEditionTrial for the Pro edition.

  • SitecoreCloudTrialEdition for the Enterprise edition.

Creating the API Keys

To configure your Sitecore instance, you will need 2 API keys that have different privileges: one for search activities (SearchApiKey) and the other for general configuration activities of your organization (ApiKey).

To create these API keys, you can either use the Cloud Platform API or the Coveo Administration Console (platform-eu | platform-au) (see Manage API Keys).

Privileges for the SearchApiKey

The SearchApiKey needs the following privileges (when creating the key using the Cloud Platform API):

owner targetDomain type Coveo Administration Console equivalent

USAGE_ANALYTICS

ANALYTICS_DATA

EDIT

Analytics - Analytics data - Push

SEARCH_API

EXECUTE_QUERY

Search - Execute queries - Allowed

SEARCH_API

IMPERSONATE

Search - Impersonate - Allowed

The SearchApiKey needs the following privileges (when creating the key using the Cloud Platform Administration Console):

SearchApiKey required Anaytics privileges
SearchApiKey required Search privileges

Privileges for the ApiKey

The ApiKey needs the following privileges (when creating the key using the Cloud Platform API):

owner targetDomain type Coveo Administration Console equivalent

PLATFORM

FIELD

VIEW, EDIT

Content - Fields - Edit

PLATFORM

SECURITY_CACHE

VIEW, EDIT

Content - Security identities - Edit

PLATFORM

SECURITY_PROVIDER

VIEW, EDIT

Content - Security identity providers - Edit

PLATFORM

SOURCE

VIEW, EDIT

Content - Sources - Edit all

PLATFORM

ORGANIZATION

VIEW, EDIT

Organization - Organization - Edit

The ApiKey needs the following privileges (when creating the key using the Cloud Platform Administration Console):

ApiKey required Content privileges
ApiKey required Organization privileges
Important

Azure’s Web Application Firewall (WAF) may block Coveo query network calls that trigger OWASP rules. You might need to disable or customize Azure WAF rules to allow Coveo for Sitecore network calls (see Azure Web Application Firewall triggered rules block Coveo for Sitecore’s communication on Content Delivery servers).