Coveo for Sitecore 5 is now available!

Silently Activating Coveo for Sitecore

Coveo for Sitecore 4.1 (April 2018)

In some circumstances, for instance 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 with the installation wizard.

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

Prerequisites

  • A running instance of Sitecore.

    For an extensive list of Sitecore supported versions, see Supported Sitecore Versions and Dependencies.

  • ASP.NET MVC 4.0 or MVC 5.0 installed on your Sitecore server:

    To configure MVC while installing Sitecore, refer to Sitecore MVC Developer’s Reference Guide. If you have already installed Sitecore and you now want to enable MVC manually, refer to Sitecore MVC Playground Part 1: Enable MVC.

  • For Sitecore 7.2 instances only:

    1. Add the assembly bindings below in your Web.config file, in the runtime/assemblyBinding node.

      <dependentAssembly>
         <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1" />
         <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.1.0.0" xmlns="urn:schemas-microsoft-com:asm.v1" />
      </dependentAssembly>
      <dependentAssembly>
         <assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1" />
         <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.1.0.0" xmlns="urn:schemas-microsoft-com:asm.v1" />
      </dependentAssembly>
      <dependentAssembly>
         <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1" />
         <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.1.0.0" xmlns="urn:schemas-microsoft-com:asm.v1" />
      </dependentAssembly>
      
    2. In the App_Config/Include/Coveo folder, open file Coveo.Service.Api.ConfigService.config.

    3. Uncomment the sitecore element as shown below and save your changes.

      <sitecore>
        <pipelines>
          <initialize>
            <processor type="Coveo.Service.Api.ConfigService.Processors.InitializeConfigServiceApiRoutes, Coveo.Service.Api.ConfigService" />
            <processor type="Coveo.Service.Api.ConfigService.Processors.InitializeConfigServiceSwagger, Coveo.Service.Api.ConfigService" />
            <processor type="Coveo.Service.Api.Framework.Processors.InitializeCoveoApiErrorFilter, Coveo.Service.Api.Framework" />
          </initialize>
        </pipelines>
      </sitecore>
      
    4. In the App_Config/Include/Coveo folder, open file Coveo.Service.Api.IndexService.config.

    5. Uncomment the pipelines element as shown below and save your changes.

      <pipelines>
        <initialize>
          <processor type="Coveo.Service.Api.IndexService.Processors.InitializeIndexServiceApiRoutes, Coveo.Service.Api.IndexService" />
          <processor type="Coveo.Service.Api.IndexService.Processors.InitializeIndexServiceSwagger, Coveo.Service.Api.IndexService" />
          <processor type="Coveo.Service.Api.Framework.Processors.InitializeCoveoApiErrorFilter, Coveo.Service.Api.Framework" />
        </initialize>
      </pipelines>
      

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_NAME]/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 Cloud Organization.

Creating an organization

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

You need to specify the organization template for a Coveo for Sitecore trial, here are the two 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 Cloud Platform Administration Console (see Adding and Managing 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 Cloud administration console equivalent
USAGE_ANALYTICS ANALYTICS_DATA VIEW,EDIT

Analytics - Analytics dataPush and view

USAGE_ANALYTICS QUERY_SUGGEST

Analytics - Suggest queriesAllowed

SEARCH_API EXECUTE_QUERY

Search - Execute queriesAllowed

SEARCH_API IMPERSONATE

Search - ImpersonateAllowed

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

Privileges for the ApiKey

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

owner targetDomain type Coveo Cloud 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):

Recommended Articles