GetKnowledgeObject
Retrieves the current content and available download URLs of a document or semantic model.
Operation description
Retrieves 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:GetKnowledgeObject |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| KnowledgeBaseId |
string |
Yes |
The ID of the knowledge base. |
12345678-1234-4234-8234-123456789abc |
| KnowledgeObjectId |
string |
Yes |
The ID of the long-term business object. |
obj-001 |
| VersionNo |
integer |
No |
The version number to read. This parameter is supported only for models. If omitted, the published version is used if available; otherwise, the latest version is used. |
1 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
The unique identifier of the request. You can use this ID to troubleshoot issues. |
00000000-0000-4000-8000-000000000001 |
| Success |
boolean |
Indicates whether the request is successful. |
|
| Data |
object |
The business data returned when the request is successful. |
|
| KnowledgeBaseId |
string |
The ID of the knowledge base. |
12345678-1234-4234-8234-123456789abc |
| KnowledgeObjectId |
string |
The object ID located 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 do not parse the ID and do not use the retrieval ID. |
obj-001 |
| Type |
string |
The object type. Valid values: SEMANTIC_MODEL and DOCUMENT. This field is extensible. |
SEMANTIC_MODEL |
| Name |
string |
The user-facing name of the object. This field is editable. Renaming the object does not change the KnowledgeObjectId. |
Sales subject model |
| Description |
string |
The description of the object. This field is editable. Pass an empty string to clear the description. |
Sales order analysis model |
| 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 field exists only when Type is set to DOCUMENT. |
|
| Text |
string |
The current document text that can be disclosed. This field is optional. It is omitted if parsing is incomplete, authorization has not been granted, or the text cannot be provided completely and securely. A single retrieved snippet must not be passed off as the entire document. |
Updated full text |
| ContentFormat |
string |
The content format. This field is required when Text exists. Valid values: MARKDOWN and TEXT. |
MARKDOWN |
| SemanticModel |
object |
The semantic model content. This field 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 field is optional. |
Actual paid amount |
| EntityId |
string |
The entity ID of the DataWorks Data Map table. This field 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 field is optional. Each item must exist in the Fields of this dataset. |
|
|
string |
The explicitly declared primary key field name. This field 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. An empty array is returned if no field definitions are provided. |
|
|
object |
|||
| Name |
string |
The name of the field. |
customer_id |
| Description |
string |
The business description of the field. This field is optional. |
Actual paid amount |
| DataType |
string |
The data type of the field. This field must be provided for publicly exposed model fields and is not guessed by the server. |
BIGINT |
| Metrics |
array<object> |
The executable metrics in the model. An empty array is returned if no metrics exist. Metrics with only candidate formulas are not included. |
|
|
array<object> |
|||
| Name |
string |
The name of the metric. |
Sales revenue |
| Description |
string |
The definition of the metric. This field is optional. |
Sales order analysis model |
| DatasetName |
string |
The name of the SemanticDataset to which the metric belongs. This dataset must be locatable in the Datasets of this model. |
orders |
| Unit |
string |
The explicitly declared unit of the metric. This field is optional and is not returned if no reliable source is available. |
CNY |
| Expression |
object |
The executable expression. It must contain at least one dialect version and is not auto-completed by the model. |
|
| Dialects |
array<object> |
The expressions of the same metric in different SQL dialects. At least one item is required. Dialects are not repeated. |
|
|
object |
|||
| Dialect |
string |
The SQL dialect, such as MaxCompute or ANSI_SQL. |
MaxCompute |
| Sql |
string |
The non-empty calculation expression in the dialect. It is not a complete query statement. |
SUM(pay_amount) |
| Relationships |
array<object> |
The defined and available field-pair relationships in the model. An empty array is returned if no relationships exist. Relationships are not guessed from graph paths. |
|
|
array<object> |
|||
| Name |
string |
The name of the relationship within the model. |
orders_to_customers |
| FromDataset |
string |
The name of the source SemanticDataset. |
orders |
| ToDataset |
string |
The name of the target SemanticDataset. |
customers |
| JoinKeys |
array<object> |
The equi-join key pairs of the fields at both ends. At least one item is required. Composite joins are listed 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 uploaded original file in bytes. This field is read-only and does not represent the length of the edited text. |
1024 |
| SourceReferences |
array<object> |
The array of source references. Currently, an empty array is returned. |
|
|
object |
|||
| Type |
string |
The category of the source reference. The structure retains KNOWLEDGE_SOURCE. Currently, SourceReferences is an empty array. |
SEMANTIC_MODEL |
| SourceId |
string |
The SourceId of the KnowledgeSource registered in this knowledge base. This field exists only when the type is KNOWLEDGE_SOURCE. |
src-001 |
| CreateTime |
integer |
The time when the object was first created. This field is not returned for existing objects whose creation time cannot be reliably determined. |
1790200800000 |
| ModifyTime |
integer |
The time when the object was modified, in milliseconds. This value is used for conditional updates of DOCUMENT text. This field does not indicate that optimistic locking updates are supported for semantic models. |
1790200800000 |
| 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 SEMANTIC_MODEL read in this request. This version is used to specify the version for subsequent saves and is not an optimistic lock. |
1 |
| DownloadUrl |
string |
The temporary download URL of the uploaded original file for DOCUMENT, or the temporary download URL of the complete specification YAML for the current version of SEMANTIC_MODEL. |
https://example.invalid/current-model-yaml |
| ExpiresIn |
integer |
The validity period of the download URL, fixed at 300 seconds. |
300 |
| DownloadFiles |
array<object> |
The complete shards returned for multi-file specification snapshots. Each item includes FileName and DownloadUrl. For single files, use DownloadUrl. |
|
|
object |
|||
| FileName |
string |
The file name of the specification YAML shard. Multiple shards form the complete model and do not represent the object identity. |
policy.md |
| DownloadUrl |
string |
The HTTPS temporary download URL of this shard. The validity period is specified by the outer ExpiresIn field. |
https://example.invalid/current-model-yaml |
| Code |
string |
The business error code. You can use this code to determine the error type when the request fails. |
InvalidParameter |
| Message |
string |
The secure 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-001",
"Type": "SEMANTIC_MODEL",
"Name": "Sales subject model",
"Description": "Sales order analysis model",
"FileName": "policy.md",
"Content": {
"Document": {
"Text": "Updated full text",
"ContentFormat": "MARKDOWN"
},
"SemanticModel": {
"Datasets": [
{
"Name": "orders",
"Description": "Actual paid amount",
"EntityId": "maxcompute-table:::project_name:schema_name:table_name",
"PrimaryKey": [
"order_id"
],
"Fields": [
{
"Name": "customer_id",
"Description": "Actual paid amount",
"DataType": "BIGINT"
}
]
}
],
"Metrics": [
{
"Name": "Sales revenue",
"Description": "Sales order analysis model",
"DatasetName": "orders",
"Unit": "CNY",
"Expression": {
"Dialects": [
{
"Dialect": "MaxCompute",
"Sql": "SUM(pay_amount)"
}
]
}
}
],
"Relationships": [
{
"Name": "orders_to_customers",
"FromDataset": "orders",
"ToDataset": "customers",
"JoinKeys": [
{
"FromField": "customer_id",
"ToField": "id"
}
]
}
]
}
},
"SizeBytes": 1024,
"SourceReferences": [
{
"Type": "SEMANTIC_MODEL",
"SourceId": "src-001"
}
],
"CreateTime": 1790200800000,
"ModifyTime": 1790200800000,
"Editable": false,
"VersionNo": 1,
"DownloadUrl": "https://example.invalid/current-model-yaml",
"ExpiresIn": 300,
"DownloadFiles": [
{
"FileName": "policy.md",
"DownloadUrl": "https://example.invalid/current-model-yaml"
}
]
},
"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.