Query data source list¶
Paginated query of data sources and their processing status in the knowledge base. The returned source record ID is an input parameter for subsequent details, governance, segmentation, and deletion interfaces.
GET https://api.moi.matrixorigin.cn/v5/semantic-models/{model_id}/sources
Preparation before calling¶
First query the knowledge base list to obtain the knowledge base ID. Prepare a personal access token and target workspace ID that has access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$MODEL_ID: ID of the knowledge base to be queried.
Request example¶
curl "https://api.moi.matrixorigin.cn/v5/semantic-models/$MODEL_ID/sources?page=1&page_size=20" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters¶
Parameters |
Type |
Description |
|---|---|---|
|
integer |
Knowledge base ID. |
Query parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
No |
Page number, must be a positive integer. |
|
integer |
No |
The number of items on a single page, ranging from |
Successful response¶
Returns 200 on success. Save data.items[].row_id; it is used by subsequent details, governance, segmentation, and deletion interfaces.
The example below is a response excerpt. See document details for the complete source schema.
{
"code": "OK",
"msg": "OK",
"data": {
"items": [
{
"row_id": "src_01",
"source_type": "file",
"model_id": 401,
"resource_id": "file_01",
"display_name": "product-guide.pdf",
"path": ["docs", "product-guide.pdf"],
"ingest_status": "ready",
"enabled": true,
"effective_enabled": true,
"governance_status": "managed"
}
],
"total": 1,
"page": 1,
"page_size": 20,
"legacy_backfill_required": false
}
}
The response fields are as follows.
The list does not return a segment snapshot ETag. Before writing segments, query document details to obtain data.etag.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
array of object |
Current page source record. |
|
string |
Source record ID. |
|
string |
Source type: |
|
integer |
ID of the knowledge base. |
|
string |
Source resource ID. |
|
string or null |
Display name. |
|
array of string |
Source path. |
|
string or null |
Source processing status. |
|
boolean or null |
Configured enabled status. |
|
boolean |
Actual effective status. |
|
string or null |
Processing error summary. |
|
string |
Source governance status; omitted when empty. |
|
integer |
Total number of source records matching the criteria. |
|
integer |
Current page number. |
|
integer |
Current page size. |
|
boolean |
Whether the old source relationship needs to be completed. |
In this document, [] after a type means an array; for example, array of string is an array of strings. In field paths, [] means each item in an array; for example, data.items[].row_id is the row_id field of each item in data.items.
Read next page¶
Calculate the last page based on data.total and page_size at the time of request, and then add page in sequence.
Error response¶
{
"code": "ErrParamInvalid",
"msg": "Bad Request"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Correct the paging parameters and try again. |
|
|
The API Key is invalid or has expired. |
Check API Key. |
|
|
The caller does not have permission to read the source. |
Check workspace and object authorization. |
|
|
The knowledge base does not exist or is not visible. |
Reconfirm |
|
|
The service failed to query the source. |
Keep the desensitized response information and try again. |
Follow-up operations¶
When legacy_backfill_required is marked as needing to be supplemented, first Complete the relationship between historical data sources; otherwise, Update data source management settings or Delete data source.