Creating an Indexing Pipeline Extension With the API

In this article

The following procedure describes how to create an indexing pipeline extension (IPE) for a Coveo organization using the Extension API.

On the Coveo Administration Console API Keys (platform-ca | platform-eu | platform-au) page, add an API key to which you grant the privilege to edit extensions (that is, the Edit access level for the Extensions domain) (see Manage privileges).

Create an extension for your organization.

  1. Use the following API call:

    POST https://platform.cloud.coveo.com/rest/organizations/<ORGANIZATION_ID>/extensions HTTP/1.1

    where you replace <ORGANIZATION_ID> with its corresponding value.

  2. Your call must include the following HTTP headers:

    Key Value

    Authorization

    Bearer <VALID_API_KEY>

    Content-Type

    application/json

  3. The body configures the extension, and it must include a name and description (see Create extension).

    Example

    The following JSON adds metadata:

    {
      "content": "document.add_meta_data({'userId':'YOUR_USER_ID'})",
      "description": "This extension adds metadata...",
      "name": "Adding the userId metadata"
    }

    where the content value is the body of your extension (user script), written in Python using the document object (see Document Object Python API Reference).

    Note

    Choose a meaningful name (such as the name of the task that you want to perform) to identify your extension.

  4. Send your request. It returns something like this:

    {
      "content": "document.add_meta_data({'userId':'YOUR_USER_ID'})",
      "description": "This extension adds metadata...",
      "enabled": true,
      "id": "coveosearch-rlic35pr6jhvtx84ta855bdj5j",
      "lastModified": 2588768294677,
      "name": "Adding the userId metadata",
      "versionId": "e3AOSVbGdwYus82z3gduTVPRqbXzidJg",
      "status": {
        "durationHealth": {
          "healthIndicator": "UNKNOWN"
        },
        "dailyStatistics": {
          "averageDurationInSeconds": 0,
          "numberOfExecutions": 0,
          "numberOfSkips": 0,
          "numberOfTimeouts": 0
        },
        "disabledStatus": {},
        "timeoutHealth": {
          "healthIndicator": "UNKNOWN"
        }
      }
    }

    where the id value is your unique extension identifier (extensionId).

On the Administration Console Activity Browser (platform-ca | platform-eu | platform-au) page, validate that your extension was successfully created.

  1. In the Sections facet, select Content.

  2. In the Resource Types facet that appears, select Extensions.

  3. In the Resources facet, select your extension ID.

  4. In the Result column, validate that your operation is successful.