Endpoints

This is for:

Developer

A search endpoint is an object whose interface allows the Coveo JavaScript Search Framework to perform HTTP requests against the Search API (for example, queries).

One of the first steps required to set up a functional search interface is to configure a search endpoint.

Configuring a new search endpoint

Use the configureCloudV2Endpoint method of the SearchEndpoint class to configure a new endpoint.

Examples
  • Initializing an endpoint which relies on API key authentication.

    Coveo.SearchEndpoint.configureCloudV2Endpoint(
      "mycoveocloudv2organizationg8tp8wu3",
      "MY_API_KEY"
    );
    // ...
    Coveo.init(document.getElementById("search"));
  • Initializing a more complex endpoint which targets a HIPAA organization and relies on search token authentication.

    // This function must return a promise
    const renewToken = () => {
      // Implementation ...
    };
    Coveo.SearchEndpoint.configureCloudV2Endpoint(
      "mycoveocloudv2organizationg8tp8wu3",
      "MY_SEARCH_TOKEN",
      "https://platformhipaa.cloud.coveo.com/rest/search",
      { renewAccessToken: renewToken }
    );
    // ...
    Coveo.init(document.getElementById("search"));

Configuring a demo search endpoint

The SearchEndpoint class exposes a configureSampleEndpointV2 method which lets you configure an endpoint that targets a demo organization whose index contains various sample items. This can be useful when you’re testing the framework.

Example

Configuring a demo search endpoint.

Coveo.SearchEndpoint.configureSampleEndpointV2();
// ...
Coveo.init(document.getElementById("search"));