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 folder is correctly formatted, 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.
Before using the Ingestion API, ensure the following requirements are met:
- A valid OAuth 2.0 access token with the
knowledge.contentmgr.managescope. - Content stored in an accessible shared file path (e.g., an SFTP server).
- Valid credentials (username and password) for accessing the shared path.
- Data to be ingested is packaged into a folder where it must follow a certain folder and file structure. For more information on the expected format, see Format Guide.
To start an ingestion job, make a POST request to the following endpoint:
https://${API_DOMAIN}/knowledge/contentmgr/v4/import/content
The request body must be a JSON object that specifies the data source, operation, and an optional schedule time.
{
"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"
}
}You can use the following cURL command to start the ingestion job. Remember to replace the placeholder values with your actual data.
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"
}
}'\<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.
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:
location: /knowledge/contentmgr/v4/import/content/7A84B875-6F75-4C7B-B137-0632B62DB0BD