Update semantic entries¶
Updates a semantic entry with the complete entry definition.
PUT https://moi.matrixorigin.cn/newmoi/semantic-models/{model_id}/entries/{entry_id}
Preparation before calling¶
First query the semantic entry to read the original entry and obtain the entry ID and existing definition to avoid missing existing fields. 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: Knowledge Base ID.$ENTRY_ID: ID of the semantic entry to be updated.
Request example¶
curl -X PUT "https://moi.matrixorigin.cn/newmoi/semantic-models/$MODEL_ID/entries/$ENTRY_ID" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"kind": "metric",
"key": "total_rows",
"spec": {
"expr": "COUNT(*)"
}
}'
Path parameters¶
Parameters |
Type |
Description |
|---|---|---|
|
integer |
Knowledge base ID. |
|
integer |
ID of the semantic entry to be updated. |
Request body¶
Updates use full replacement semantics. Resubmit kind, key, and spec; also resubmit tables when you need to preserve the association table. The kind of the created entry cannot be changed.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Entry type; must be consistent with the type of an existing entry and determines the structure of |
|
string |
Yes |
A stable reference key within the knowledge base. |
|
array[string] |
No |
Association table name; resubmit if needed. |
|
object |
Yes |
A type-specific configuration object. See Create semantic entry for the complete fields and constraints. |
Successful response¶
Returns 200 on success. The interface returns a confirmation mark; if you need to read the latest entry definition, please query the entry list again.
{
"code": "OK",
"msg": "OK",
"data": {
"updated": true
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
boolean |
|
Error response¶
{
"code": "ErrNotFound",
"msg": "resource not found",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The path ID or full entry definition is invalid, or |
After re-reading the entries, submit the complete |
|
|
The API Key is invalid or has expired. |
Check API Key. |
|
|
The caller does not have update permissions. |
Check workspace and object authorization. |
|
|
The knowledge base or entry does not exist or is not visible to the current caller. |
Reconfirm ID. |
|
|
Entry key conflicts with existing definition. |
Adjust |
|
|
The service failed to update the entry. |
Keep the desensitized response information and try again. |
Follow-up operations¶
Query semantic entries reads the latest updated entry definition.