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://moi.matrixorigin.cn/newmoi/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 the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $MODEL_ID: ID of the knowledge base to be queried.

Request example

curl "https://moi.matrixorigin.cn/newmoi/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

model_id

integer

Knowledge base ID.

Query parameters

Parameter

Type

Required

Description

page

integer

No

Page number, must be a positive integer.

page_size

integer

No

The number of items on a single page, ranging from 1 to 100.

Successful response

Returns 200 on success. Save data.items[].row_id; it is used by subsequent details, governance, segmentation, and deletion interfaces.

{
  "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,
        "segment_version_id": "ver_02",
        "index_version": 2,
        "governance_status": "managed"
      }
    ],
    "total": 1,
    "page": 1,
    "page_size": 20,
    "legacy_backfill_required": false
  }
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.items

object[]

Current page source record.

data.items[].row_id

string

Source record ID.

data.items[].source_type

string

Source type: file, volume, or table.

data.items[].model_id

integer

ID of the knowledge base.

data.items[].resource_id

string

Source resource ID.

data.items[].display_name

string

Display name.

data.items[].path

string[]

Source path.

data.items[].ingest_status

string

Source processing status.

data.items[].enabled

boolean

Configured enabled status.

data.items[].effective_enabled

boolean

Actual effective status.

data.items[].segment_version_id

string

Current segment version; may be empty if not generated.

data.items[].index_version

integer

Current index version; may be empty if not generated.

data.items[].error

string

Processing error summary; may be empty if there are no errors.

data.items[].governance_status

string

Source governance status.

data.total

integer

Total number of source records matching the criteria.

data.page

integer

Current page number.

data.page_size

integer

Current page size.

data.legacy_backfill_required

boolean

Whether the old source relationship needs to be completed.

In this document, [] after a type means an array; for example, 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.

Error response

{
  "code": "ErrParamInvalid",
  "msg": "page_size is invalid",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

ErrParamInvalid

model_id, page or page_size are not valid.

Correct the paging parameters and try again.

401

ErrUnauthorized

The API Key is invalid or has expired.

Check API Key.

403

ErrForbidden

The caller does not have permission to read the source.

Check workspace and object authorization.

404

ErrNotFound

The knowledge base does not exist or is not visible.

Reconfirm model_id.

500

ErrServer

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.

Last updated on