Starting an Ingestion Job: Shared File Path Datasource

This section walks you through the process of initiating a content ingestion job from a shared file path (e.g., SFTP) using the Ingestion API. This API is designed for customers who have external content that they wish to import into the eGain AI Knowledge Hub. To do this, you must first package and format your content according to our specified import file structure, which is detailed in the Format Guide. Once your content is correctly formatted and zipped, you can upload it to your accessible shared path. From there, this API consumes the file and begins the process of importing it into your knowledge base.

Prerequisites

Before using the Ingestion API, ensure the following requirements are met:

  • A valid OAuth 2.0 access token with the knowledge.contentmgr.manage scope.
  • Content stored in an accessible shared file path (e.g., an SFTP server).
  • Valid credentials (username and password) for accessing the shared path.
  • The data to be ingested is packaged as a .zip file. For more information on the expected format, see Format Guide .

API Endpoint

To start an ingestion job, make a POST request to the following endpoint:

https://${API_DOMAIN}/knowledge/contentmgr/v4/import/content

Request Body

The request body must be a JSON object that specifies the data source, operation, and an optional schedule time.

Example Payload

Copy
Copied
{
  "dataSource": {
    "type": "Shared file path",
    "path": "sftp://server.com/content/updates/",
    "credentials": {
      "username": "contentuser",
      "password": "securepassword"
    }
  },
  "operation": "import",
  "scheduleTime": {
    "date": "2024-03-01T02:00:00.000Z"
  }
}

Using cURL to Start the Ingestion Job

You can use the following cURL command to start the ingestion job. Remember to replace the placeholder values with your actual data.

Copy
Copied
curl --location --request POST 'https://<API_DOMAIN>/knowledge/contentmgr/v4/import/content' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "dataSource": {
        "type": "Shared file path",
        "path": "sftp://your-server.com/path/to/content/",
        "credentials": {
            "username": "YOUR_USERNAME",
            "password": "YOUR_PASSWORD"
        }
    },
    "operation": "import",
    "scheduleTime": {
        "date": "2024-03-01T02:00:00.000Z"
    }
}'

Placeholders to Replace:

  • \<API_DOMAIN> : The domain of your API.
  • <YOUR_ACCESS_TOKEN> : Your OAuth 2.0 access token.
  • sftp://your-server.com/path/to/content/ : The SFTP path to your content file.
  • YOUR_USERNAME : The username for accessing the shared path, if applicable.
  • YOUR_PASSWORD : The password for the specified user, if applicable.

Successful Response

A successful request returns a 202 Accepted status code. The location header in the response contains the URL to check the status of the import job.

Example Response Header:

Copy
Copied
location: /knowledge/contentmgr/v4/import/content/7A84B875-6F75-4C7B-B137-0632B62DB0BD