Add data source¶
Add a data source to an existing knowledge base. Parsing and indexing of data sources is done by processing tasks.
POST $CLOUDSIGMA_API_BASE/semantic-models/{model_id}/sources
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First check whether has been added to the data source and remove duplicates. When selecting in batches by database or volume, first Preview the data source to be added. Prepare a personal access token and target workspace ID that can access the target workspace.
Request body¶
Replace $MODEL_ID, $CLOUDSIGMA_API_KEY, $WORKSPACE_ID in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/semantic-models/$MODEL_ID/sources" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"sources": [
{
"source_type": "catalog_file",
"file_id": "<FILE_ID>"
}
]
}'
When adding sources directly, fields are provided by source type:
Source type |
Required fields |
|---|---|
|
|
|
|
|
File ID returned by uploading local file, original |
Selecting by range only supports Database and Volume of Catalog. You cannot use source_selections to add data sources other than Catalog.
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
Belonging knowledge base ID. |
Request body
Field |
Type |
Required |
Description |
|---|---|---|---|
|
array of object |
Yes |
List of data source objects added directly. Provide at least one item with |
|
string |
No |
Source type. Values: |
|
string |
No |
File name. |
|
string |
No |
Upload method. |
|
string |
No |
Create table configuration JSON text. |
|
string |
No |
File ID. |
|
integer |
No |
Table ID. |
|
string |
No |
Base64 encoded content of the local file. |
|
string |
No |
Selection range: |
|
integer |
No |
Database ID. |
|
integer |
No |
Volume ID. |
|
boolean |
No |
Whether to select all. |
|
integer (array of integers) or null |
No |
Selected table ID. |
|
integer (array of integers) or null |
No |
Excluded table ID. |
|
array of string or null |
No |
Selected file ID. |
|
array of string or null |
No |
Excluded file IDs. |
|
object |
No |
Filter criteria. |
|
string |
No |
Table name. |
|
string |
No |
File name. |
|
array of string or null |
No |
File extension. |
|
string |
No |
Table name. |
|
array of string or null |
No |
File extension. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"data_domain": {
"model_id": 401,
"catalog_id": 10,
"database_id": 20,
"raw_volume_id": 30,
"processed_volume_id": 31,
"ensure_status": "ready"
},
"sources": [
{
"row_id": "src_01",
"source_type": "file",
"model_id": 401,
"resource_id": "file_01",
"display_name": null,
"path": [],
"db_name": null,
"table_name": null,
"size_bytes": null,
"row_count": null,
"ingest_status": "pending",
"enabled": null,
"expires_at": null,
"expired": false,
"effective_enabled": true,
"force_enabled_after_expiry": false,
"updated_at": null,
"error": null
}
],
"jobs": [
{
"job_id": "job_01",
"source_id": "src_01",
"model_id": 401,
"job_type": "load",
"job_status": "pending",
"idempotency_key": "idem_01",
"retry_count": 0
}
]
}
}
Field |
Type |
Description |
|---|---|---|
|
object |
Catalog, database and file volume information associated with this knowledge base, as well as storage preparation status. |
|
integer |
knowledge base ID. |
|
integer |
CatalogID。 |
|
integer |
Database ID. |
|
integer |
Original file volume ID. |
|
integer |
Handles file volume IDs. |
|
string |
Storage readiness status. Values: |
|
string |
Recent preparation errors. Omitted if there is no error. |
|
integer |
Last checked time. |
|
array of object |
Source record created. |
|
string |
Record ID. |
|
string |
Source ID. |
|
string |
Source type. Value: |
|
integer |
Model ID. |
|
string |
Resource ID. |
|
string |
Source resource ID. |
|
string |
knowledge base resource ID. |
|
string |
Source file ID. |
|
string |
knowledge base file ID. |
|
integer |
Source table ID. |
|
integer |
knowledge base table ID. |
|
string or null |
Display name. |
|
array of string |
path. |
|
string |
Source path. |
|
string or null |
Database name. |
|
string or null |
Table name. |
|
integer or null |
size in bytes. |
|
integer or null |
Number of rows. |
|
string or null |
Import status. Values: |
|
boolean or null |
Whether to enable. |
|
integer or null |
Expiration time. |
|
boolean |
Has it expired? |
|
boolean |
actual enabled status. |
|
boolean |
Whether to force activation after expiration. |
|
array of string |
tag list. |
|
string |
Creator. |
|
string |
Last updated by. |
|
integer or null |
Update time. |
|
string or null |
error message. |
|
string |
Management status. Value: |
|
string |
Old source information. Value: |
|
array of object |
Create a new processing task. |
|
string |
Process task ID. |
|
string |
Source ID. |
|
integer |
Model ID. |
|
string |
Processing task type. Values: |
|
string |
Handle task status. Values: |
|
string |
Idempotent request key. |
|
string |
Operation ID. |
|
string |
workflow execution ID. |
|
string |
Source file ID. |
|
string |
knowledge base file ID. |
|
integer |
Source table ID. |
|
integer |
knowledge base table ID. |
|
integer |
Number of retries. |
|
integer |
Next retry time. |
|
string |
error message. |
|
integer |
Creation time. |
|
integer |
Update time. |
|
boolean |
Whether the processing status needs to be repaired. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "Bad Request"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
Error description. |