Query the knowledge base list¶
Paginated list of knowledge bases (semantic models) that can be read by the current workspace. First find the knowledge base ID through this interface, and then query the details or add a data source.
GET https://moi.matrixorigin.cn/newmoi/semantic-models
Preparation before calling¶
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: The workspace ID to be queried is passed through theX-Workspace-IDHeader.
Request example¶
curl "https://moi.matrixorigin.cn/newmoi/semantic-models?page_size=20&search=product&tags=product" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Query parameters¶
The interface supports server-side paging; continue to use the next_page_token returned in the response, and do not infer the last page based on the number of entries on the current page.
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
No |
The number of items in a single page, ranging from |
|
string |
No |
|
|
string |
No |
Search criteria for name or description. |
|
string[] |
No |
Tag filter condition. Repeat passing in parameters, such as |
[] after a type means an array. For example, string[] is an array of strings.
Successful response¶
Returns 200 on success. Get the knowledge base of the current page from data.items; when data.next_page_token is empty or not returned, it means there is no next page.
{
"code": "OK",
"msg": "OK",
"data": {
"items": [
{
"id": 401,
"name": "product_docs",
"description": "产品文档",
"tables": [],
"files": [],
"source_counts": {
"files": 2,
"tables": 1,
"total": 3
},
"created_at": 1735632000,
"updated_at": 1735718400
}
],
"total": 1,
"next_page_token": ""
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
object[] |
The knowledge base of the current page. |
|
integer |
Knowledge base ID, |
|
string |
Knowledge base name. |
|
string |
Knowledge base description; may be omitted if not set. |
|
JSON |
Compatible legacy table source definition. |
|
JSON |
Compatible legacy file source definition; may be omitted if not set. |
|
object |
Number of sources for list or detail path supplements. |
|
integer |
Number of file sources. |
|
integer |
Table source number. |
|
integer |
Total number of sources. |
|
integer |
Creation time as a Unix timestamp. |
|
integer |
Update time as a Unix timestamp. |
|
integer |
The total number of matches that match the current filter criteria. |
|
string |
The token passed in unchanged when reading the next page. |
In field paths, [] means each item in an array. For example, data.items[].id is the id field of each item in data.items.
Read next page¶
When data.next_page_token is non-empty, pass it into the next request as page_token until an empty token is returned.
Error response¶
The same envelope is returned on request failure, where data is null.
{
"code": "ErrParamInvalid",
"msg": "page_size is invalid",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Correct the page size and try again. |
|
|
The API Key is invalid or has expired. |
Check API Key. |
|
|
The caller does not have permission to read the knowledge base collection. |
Check workspace and object authorization. |
|
|
The service failed to complete the list query. |
Keep the desensitized response information and try again. |
Follow-up operations¶
Use data.items[].id Query knowledge base details.