Query knowledge base tags¶
Reading the current workspace can read the tag statistics of the knowledge base.
GET https://api.moi.matrixorigin.cn/v5/semantic-models/tags
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://api.moi.matrixorigin.cn/v5/semantic-models/tags?search=product" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Query parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Only count knowledge base tags that match the search criteria. |
Successful response¶
Returns 200 on success. data.items is the label statistics list.
{
"code": "OK",
"msg": "OK",
"data": {
"items": [
{
"tag": "product",
"count": 3
},
{
"tag": "support",
"count": 1
}
]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
array of object |
Tag statistics list; if there is no tag, it is an empty array. |
|
string |
Tag name. |
|
integer |
The number of knowledge bases with this tag that can be read by the current caller. |
In field paths, [] means each item in an array. For example, data.items[].tag is the tag field of each item in data.items.
Error response¶
{
"code": "ErrForbidden",
"msg": "permission denied",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
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 tag aggregation. |
Keep the desensitized response information and try again. |
Follow-up operations¶
Filter by tag Query the knowledge base list.