UpdateKnowledgeObject
Updates the name, description, or content of a document or semantic model.
Operation description
Updates a knowledge object. The tenant and caller identities are determined by the POP authentication context.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:UpdateKnowledgeObject |
update |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| KnowledgeBaseId |
string |
Yes |
The ID of the knowledge base to which the object belongs. |
12345678-1234-4234-8234-123456789abc |
| KnowledgeObjectId |
string |
Yes |
The stable knowledge object ID returned by the Get or List operation. |
obj-model-001 |
| Name |
string |
No |
The new name. This parameter cannot be empty. If this parameter is not specified, the original value is retained. |
orders |
| Description |
string |
No |
The new description. An empty string clears the description. If this parameter is not specified, the original value is retained. |
Actual payment amount |
| Content |
object |
No |
The typed content update. Object properties are submitted as needed. When an array is submitted, it replaces the entire existing array. Unspecified properties are retained. |
|
| Document |
object |
No |
The document content. This property exists only when Type is set to DOCUMENT. |
|
| Text |
string |
No |
The current document body that can be disclosed. This property is optional. Omit this property if parsing is incomplete, authorization is not granted, or the full document cannot be provided completely and securely. Do not pass a single retrieved snippet as the entire document. |
Updated full text |
| ContentFormat |
string |
No |
The content format. This property is required when Text is specified. Valid values: MARKDOWN and TEXT. |
MARKDOWN |
| SemanticModel |
object |
No |
The semantic model content. This property exists only when Type is set to SEMANTIC_MODEL. |
|
| Datasets |
array<object> |
No |
The logical datasets contained in the model. If no datasets can be disclosed, this property is an empty array. |
|
|
array<object> |
No |
|||
| Name |
string |
No |
The name of the dataset within the model. This name is used for relationship positioning within the model. |
orders |
| Description |
string |
No |
The business description of the dataset. This property is optional. |
Actual payment amount |
| EntityId |
string |
No |
The entity ID of the DataWorks Data Map table. This property is returned when a reliable association exists. For an existing dataset with the same name, the entity ID is retained if it is not specified. Submitted values are processed according to the semantic layer saving rules. |
maxcompute-table:::project_name:schema_name:table_name |
| PrimaryKey |
array |
No |
The explicitly declared primary key field name. This property is optional. Each item must exist in the Fields of this dataset. |
|
|
string |
No |
The explicitly declared primary key field name. This property is optional. Each item must exist in the Fields of this dataset. |
order_id |
|
| Fields |
array<object> |
No |
The fields defined in the dataset that are permitted to be disclosed. If no field definitions are provided, this property is an empty array. |
|
|
object |
No |
|||
| Name |
string |
No |
The name of the field. |
pay_amount |
| Description |
string |
No |
The business description of the field. This property is optional. |
Actual payment amount |
| DataType |
string |
No |
The data type of the field. This property must be provided for model fields that are disclosed and is not inferred by the server. |
DECIMAL |
| Metrics |
array<object> |
No |
The executable metrics in the model. If no metrics are available, this property is an empty array. Do not include metrics that only have candidate formulas. |
|
|
array<object> |
No |
|||
| Name |
string |
No |
The name of the metric. |
Net sales |
| Description |
string |
No |
The definition of the metric. This property is optional. |
Actual payment amount minus refund amount |
| DatasetName |
string |
No |
The name of the SemanticDataset to which the metric belongs. This name must be locatable in the Datasets of this model. |
orders |
| Unit |
string |
No |
The explicitly declared unit of the metric. This property is optional. It is not returned when no reliable source is available. |
CNY |
| Expression |
object |
No |
The executable expression. This property must contain at least one dialect version and is not auto-generated by the model. |
|
| Dialects |
array<object> |
No |
The expressions of the same metric in different SQL dialects. At least one item is required. Dialects must not be duplicated. |
|
|
object |
No |
|||
| Dialect |
string |
No |
The SQL dialect, such as MaxCompute or ANSI_SQL. |
MaxCompute |
| Sql |
string |
No |
The non-empty calculation expression in the specified dialect. This is not a complete query statement. |
SUM(pay_amount - refund_amount) |
| Relationships |
array<object> |
No |
The defined relationships in the model expressed by field pairs. If no relationships are available, this property is an empty array. Do not infer relationships from graph paths. |
|
|
array<object> |
No |
|||
| Name |
string |
No |
The name of the relationship within the model. |
orders |
| FromDataset |
string |
No |
The name of the source SemanticDataset. |
orders |
| ToDataset |
string |
No |
The name of the destination SemanticDataset. |
customers |
| JoinKeys |
array<object> |
No |
The equi-join key pairs of the fields at both ends. At least one item is required. For composite relationships, list the pairs item by item. |
|
|
object |
No |
|||
| FromField |
string |
No |
The field name in FromDataset.Fields. |
customer_id |
| ToField |
string |
No |
The field name in ToDataset.Fields. |
id |
| UploadId |
string |
No |
The upload ID. This parameter is supported only for SEMANTIC_MODEL. It replaces the publicly accessible model content with a complete YAML file and is mutually exclusive with Content. |
12345678-1234-4234-8234-123456789abd |
| ClientToken |
string |
No |
The client token. This parameter is supported only for DOCUMENT. Model updates do not guarantee exactly-once remote save notifications. |
edit-document-text-001 |
| ExpectedModifyTime |
integer |
No |
The expected modification time. This parameter is supported only for DOCUMENT. It is required when modifying the body text and optional when modifying metadata. |
1790200800000 |
| VersionNo |
integer |
No |
The version number. This parameter is required when updating Content or UploadId for SEMANTIC_MODEL. Use the VersionNo returned by the Get operation. This parameter is not an optimistic lock. |
1 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
The unique identifier of the request, which can be used to troubleshoot issues. |
00000000-0000-4000-8000-000000000001 |
| Success |
boolean |
Indicates whether the request is successful. |
|
| Data |
object |
The business data returned if the request is successful. |
|
| KnowledgeBaseId |
string |
The ID of the knowledge base to which the object belongs. |
12345678-1234-4234-8234-123456789abc |
| KnowledgeObjectId |
string |
The ID used to locate the object by type. For semantic models, the modelId of the semantic layer is used. For documents, a stable ID generated by the local document table is used. Callers must not parse the ID or use retrieval IDs. |
obj-model-001 |
| Type |
string |
The object type. Valid values: SEMANTIC_MODEL and DOCUMENT. This field is extensible. |
SEMANTIC_MODEL |
| Name |
string |
The user-facing name. This field is editable. Renaming the object does not change the KnowledgeObjectId. |
orders |
| Description |
string |
The description. This field is editable. Pass an empty string to clear the description. |
Actual payment amount |
| FileName |
string |
The original file name of the uploaded document. This field is read-only. Renaming the object does not change this value. This field is not returned for external documents and semantic models. |
policy.md |
| Content |
object |
The current valid typed knowledge content. The document or semantic model structure is returned based on the type. |
|
| Document |
object |
The document content. This property exists only when Type is set to DOCUMENT. |
|
| Text |
string |
The current document body that can be disclosed. This property is optional. Omit this property if parsing is incomplete, authorization is not granted, or the full document cannot be provided completely and securely. Do not pass a single retrieved snippet as the entire document. |
Updated full text |
| ContentFormat |
string |
The content format. This property is required when Text is specified. Valid values: MARKDOWN and TEXT. |
MARKDOWN |
| SemanticModel |
object |
The semantic model content. This property exists only when Type is set to SEMANTIC_MODEL. |
|
| Datasets |
array<object> |
The logical datasets contained in the model. An empty array is returned if no datasets can be disclosed. |
|
|
array<object> |
|||
| Name |
string |
The name of the dataset within the model. This name is used for relationship positioning within the model. |
orders |
| Description |
string |
The business description of the dataset. This property is optional. |
Actual payment amount |
| EntityId |
string |
The entity ID of the DataWorks Data Map table. This property is returned when a reliable association exists. For an existing dataset with the same name, the entity ID is retained if it is not specified. Submitted values are processed according to the semantic layer saving rules. |
maxcompute-table:::project_name:schema_name:table_name |
| PrimaryKey |
array |
The explicitly declared primary key field name. This property is optional. Each item must exist in the Fields of this dataset. |
|
|
string |
The explicitly declared primary key field name. This property is optional. Each item must exist in the Fields of this dataset. |
order_id |
|
| Fields |
array<object> |
The fields defined in the dataset that are permitted to be disclosed. If no field definitions are provided, this property is an empty array. |
|
|
object |
|||
| Name |
string |
The name of the field. |
pay_amount |
| Description |
string |
The business description of the field. This property is optional. |
Actual payment amount |
| DataType |
string |
The data type of the field. This property must be provided for model fields that are disclosed and is not inferred by the server. |
DECIMAL |
| Metrics |
array<object> |
The executable metrics in the model. If no metrics are available, this property is an empty array. Do not include metrics that only have candidate formulas. |
|
|
array<object> |
|||
| Name |
string |
The name of the metric. |
Net sales |
| Description |
string |
The definition of the metric. This property is optional. |
Actual payment amount minus refund amount |
| DatasetName |
string |
The name of the SemanticDataset to which the metric belongs. This name must be locatable in the Datasets of this model. |
orders |
| Unit |
string |
The explicitly declared unit of the metric. This property is optional. It is not returned when no reliable source is available. |
CNY |
| Expression |
object |
The executable expression. This property must contain at least one dialect version and is not auto-generated by the model. |
|
| Dialects |
array<object> |
The expressions of the same metric in different SQL dialects. At least one item is required. Dialects must not be duplicated. |
|
|
object |
|||
| Dialect |
string |
The SQL dialect, such as MaxCompute or ANSI_SQL. |
MaxCompute |
| Sql |
string |
The non-empty calculation expression in the specified dialect. This is not a complete query statement. |
SUM(pay_amount - refund_amount) |
| Relationships |
array<object> |
The defined relationships in the model expressed by field pairs. If no relationships are available, this property is an empty array. Do not infer relationships from graph paths. |
|
|
array<object> |
|||
| Name |
string |
The name of the relationship within the model. |
orders |
| FromDataset |
string |
The name of the source SemanticDataset. |
orders |
| ToDataset |
string |
The name of the destination SemanticDataset. |
customers |
| JoinKeys |
array<object> |
The equi-join key pairs of the fields at both ends. At least one item is required. For composite relationships, list the pairs item by item. |
|
|
object |
|||
| FromField |
string |
The field name in FromDataset.Fields. |
customer_id |
| ToField |
string |
The field name in ToDataset.Fields. |
id |
| SizeBytes |
integer |
The size of the original uploaded file in bytes. This field is read-only and does not represent the length of the edited body. |
1024 |
| SourceReferences |
array<object> |
The array of source references. Currently, an empty array is returned. |
|
|
object |
|||
| Type |
string |
The source reference category. The structure retains KNOWLEDGE_SOURCE. Currently, SourceReferences is an empty array. |
SEMANTIC_MODEL |
| SourceId |
string |
The SourceId of the KnowledgeSource registered in the knowledge base. This field exists only when the type is KNOWLEDGE_SOURCE. |
src-001 |
| CreateTime |
integer |
The time when the object was first created. |
1790200800000 |
| ModifyTime |
integer |
The time when the object was last modified, in milliseconds. This value is used for conditional updates of the DOCUMENT body. This field does not indicate that optimistic locking updates are supported for semantic models. |
1791789000000 |
| Editable |
boolean |
Indicates whether the current caller has full content editing permissions. The value is true for OWNER and ADMIN, and false for VIEWER. Permissions are checked again for write operations. |
|
| VersionNo |
integer |
The version of the model saved and retrieved in this operation. |
1 |
| DownloadUrl |
string |
The temporary download URL for the single-file specification YAML. This field is optional. |
https://example.invalid/short-lived-result-download |
| ExpiresIn |
integer |
The validity period of the download URL, in seconds. This field is optional. |
300 |
| DownloadFiles |
array<object> |
The complete specification shards for multi-file models. Each item includes FileName and DownloadUrl. This field is optional. |
|
|
object |
|||
| FileName |
string |
The original file name of the uploaded document. This field is read-only. Renaming the object does not change this value. This field is not returned for external documents and semantic models. |
policy.md |
| DownloadUrl |
string |
The temporary download URL for the single-file specification YAML. This field is optional. |
https://example.invalid/short-lived-result-download |
| Code |
string |
The business error code. This code is used to determine the error type when a request fails. |
InvalidParameter |
| Message |
string |
The error message returned when the request fails. |
The request parameters are invalid |
Examples
Success response
JSON format
{
"RequestId": "00000000-0000-4000-8000-000000000001",
"Success": false,
"Data": {
"KnowledgeBaseId": "12345678-1234-4234-8234-123456789abc",
"KnowledgeObjectId": "obj-model-001",
"Type": "SEMANTIC_MODEL",
"Name": "orders",
"Description": "Actual payment amount",
"FileName": "policy.md",
"Content": {
"Document": {
"Text": "Updated full text",
"ContentFormat": "MARKDOWN"
},
"SemanticModel": {
"Datasets": [
{
"Name": "orders",
"Description": "Actual payment amount",
"EntityId": "maxcompute-table:::project_name:schema_name:table_name",
"PrimaryKey": [
"order_id"
],
"Fields": [
{
"Name": "pay_amount",
"Description": "Actual payment amount",
"DataType": "DECIMAL"
}
]
}
],
"Metrics": [
{
"Name": "Net sales",
"Description": "Actual payment amount minus refund amount",
"DatasetName": "orders",
"Unit": "CNY",
"Expression": {
"Dialects": [
{
"Dialect": "MaxCompute",
"Sql": "SUM(pay_amount - refund_amount)"
}
]
}
}
],
"Relationships": [
{
"Name": "orders",
"FromDataset": "orders",
"ToDataset": "customers",
"JoinKeys": [
{
"FromField": "customer_id",
"ToField": "id"
}
]
}
]
}
},
"SizeBytes": 1024,
"SourceReferences": [
{
"Type": "SEMANTIC_MODEL",
"SourceId": "src-001"
}
],
"CreateTime": 1790200800000,
"ModifyTime": 1791789000000,
"Editable": false,
"VersionNo": 1,
"DownloadUrl": "https://example.invalid/short-lived-result-download",
"ExpiresIn": 300,
"DownloadFiles": [
{
"FileName": "policy.md",
"DownloadUrl": "https://example.invalid/short-lived-result-download"
}
]
},
"Code": "InvalidParameter",
"Message": "The request parameters are invalid"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The request parameters are invalid. | |
| 400 | UploadIncomplete | The upload or content is invalid. | |
| 400 | InputTooLarge | The upload or content is invalid. | |
| 500 | InternalError | The knowledge base operation failed. Use RequestId to contact support. | |
| 403 | Forbidden | You are not authorized to perform this operation. | |
| 404 | ResourceNotFound | The requested resource does not exist or is not visible. | |
| 409 | Conflict | The resource state conflicts with this operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.