ListKnowledgeObjects

Updated at:

Lists knowledge objects in a knowledge base with pagination.

Operation description

Lists knowledge objects. The tenant and caller identities are determined by the POP authentication context.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:ListKnowledgeObjects

list

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

KnowledgeBaseId

string

Yes

The target knowledge base.

12345678-1234-4234-8234-123456789abc

Type

string

No

The object type. Valid values: SEMANTIC_MODEL and DOCUMENT.

Valid values:

  • DOCUMENT
  • SEMANTIC_MODEL

DOCUMENT

MaxResults

integer

No

The maximum number of entries per page.

20

NextToken

string

No

The pagination cursor.

eyJvZmZzZXQiOjIwfQ

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.

Objects

array<object>

The knowledge objects that you have permission to read on the current page.

array<object>

KnowledgeBaseId

string

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 from 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 a retrieval ID.

obj-001

Type

string

The object type. Valid values: SEMANTIC_MODEL and DOCUMENT. This field is extensible in the future.

DOCUMENT

Name

string

The user-facing name of the object. This field is editable. Renaming the object does not change the KnowledgeObjectId.

Sales policy

Description

string

The brief description of the object. This field is editable. Pass an empty string to clear the description.

Sales metrics and policy documents

FileName

string

The original file name of the uploaded document. This field is read-only. Renaming the Name field does not change this value. This field is not returned for external documents and semantic models.

policy.md

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

CreateTime

integer

The time when the object was first created.

1790200800000

ModifyTime

integer

The time when the current content was last updated.

1790200800000

Content

object

The typed content of the knowledge object. The semantic model content or document content is returned based on the Type field.

Document

object

The document content. This field exists only when Type is set to DOCUMENT.

Text

string

The full text of the current document that can be returned to the caller. This field is optional. It is omitted if parsing is incomplete, authorization is missing, or the full text cannot be provided securely. A single retrieved snippet is not used to represent the entire document.

Updated full text

ContentFormat

string

The content format. This field is required when Text is present. In the initial release, the supported values are 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 included in the model. An empty array is returned if none of the datasets can be exposed.

array<object>

Name

string

The user-facing name of the object. This field is editable. Renaming the object does not change the KnowledgeObjectId.

Sales policy

Description

string

The brief description of the object. This field is editable. Pass an empty string to clear the description.

Sales metrics and policy documents

EntityId

string

The metadata entity ID returned by Data Map. Clients must pass this ID as-is and must not concatenate it.

maxcompute-table:::project_name:schema_name:table_name

PrimaryKey

array

The explicitly declared primary key field names. This list is optional. Each name must be present in Fields for this dataset.

string

A declared primary key field name. It must be present in Fields for this dataset.

order_id

Fields

array<object>

The defined fields that can be exposed of the dataset. An empty array is returned if no field definitions are provided.

object

Name

string

The user-facing name of the object. This field is editable. Renaming the object does not change the KnowledgeObjectId.

Sales policy

Description

string

The brief description of the object. This field is editable. Pass an empty string to clear the description.

Sales metrics and policy documents

DataType

string

The data type of the field. This field is required for model fields that can be exposed and is not inferred 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 user-facing name of the object. This field is editable. Renaming the object does not change the KnowledgeObjectId.

Sales policy

Description

string

The brief description of the object. This field is editable. Pass an empty string to clear the description.

Sales metrics and policy documents

DatasetName

string

The name of the semantic dataset to which the metric belongs. This name must be locatable in the Datasets of the current 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 include 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)

Relationships

array<object>

The defined relationships in the model expressed by field pairs. An empty array is returned if no relationships exist. Relationships are not inferred from graph paths.

array<object>

Name

string

The user-facing name of the object. This field is editable. Renaming the object does not change the KnowledgeObjectId.

Sales policy

FromDataset

string

The name of the starting semantic dataset.

orders

ToDataset

string

The name of the ending semantic dataset.

customers

JoinKeys

array<object>

The equi-join key pairs for the fields at both ends of the relationship. For composite relationships, fields are paired one by one.

object

FromField

string

The name of the field in the starting dataset that participates in the relationship. This field must be defined in the Fields of the dataset corresponding to FromDataset.

customer_id

ToField

string

The name of the field in the ending dataset that participates in the relationship. This field must be defined in the Fields of the dataset corresponding to ToDataset.

id

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.

DOCUMENT

SourceId

string

The KnowledgeSource.SourceId registered in the current knowledge base. This field is present only for KNOWLEDGE_SOURCE.

src-001

Editable

boolean

Indicates whether the current caller has full content editing permissions. The value is true for OWNER and ADMIN, and false for VIEWER. The server checks authorization again for write operations.

VersionNo

integer

The current version of the SEMANTIC_MODEL being read. Pass this value when updating content. The version can be edited in place.

1

DownloadUrl

string

The temporary download URL for the specification YAML file. The validity period is subject to ExpiresIn.

https://example.invalid/short-lived-result-download

ExpiresIn

integer

The validity period of the knowledge object download URL in seconds. The current value is 300 seconds.

300

DownloadFiles

array<object>

The download items for multi-file specification YAMLs, including file names and temporary download URLs.

object

FileName

string

The original file name of the uploaded document. This field is read-only. Renaming the Name field 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 specification YAML file. The validity period is subject to ExpiresIn.

https://example.invalid/short-lived-result-download

NextToken

string

The cursor for the next page. The value is null if there is no next page.

eyJvZmZzZXQiOjIwfQ

Code

string

The business error code. You can use this code to determine the error type when a request fails.

InvalidParameter

Message

string

The secure error message returned when the request fails.

The request parameters are invalid

MaxResults

integer

The maximum number of entries per page.

20

Examples

Success response

JSON format

{
  "RequestId": "00000000-0000-4000-8000-000000000001",
  "Success": false,
  "Data": {
    "Objects": [
      {
        "KnowledgeBaseId": "12345678-1234-4234-8234-123456789abc",
        "KnowledgeObjectId": "obj-001",
        "Type": "DOCUMENT",
        "Name": "Sales policy",
        "Description": "Sales metrics and policy documents",
        "FileName": "policy.md",
        "SizeBytes": 1024,
        "CreateTime": 1790200800000,
        "ModifyTime": 1790200800000,
        "Content": {
          "Document": {
            "Text": "Updated full text",
            "ContentFormat": "MARKDOWN"
          },
          "SemanticModel": {
            "Datasets": [
              {
                "Name": "Sales policy",
                "Description": "Sales metrics and policy documents",
                "EntityId": "maxcompute-table:::project_name:schema_name:table_name",
                "PrimaryKey": [
                  "order_id"
                ],
                "Fields": [
                  {
                    "Name": "Sales policy",
                    "Description": "Sales metrics and policy documents",
                    "DataType": "BIGINT"
                  }
                ]
              }
            ],
            "Metrics": [
              {
                "Name": "Sales policy",
                "Description": "Sales metrics and policy documents",
                "DatasetName": "orders",
                "Unit": "CNY",
                "Expression": {
                  "Dialects": [
                    {
                      "Dialect": "MaxCompute",
                      "Sql": "SUM(pay_amount)"
                    }
                  ]
                }
              }
            ],
            "Relationships": [
              {
                "Name": "Sales policy",
                "FromDataset": "orders",
                "ToDataset": "customers",
                "JoinKeys": [
                  {
                    "FromField": "customer_id",
                    "ToField": "id"
                  }
                ]
              }
            ]
          }
        },
        "SourceReferences": [
          {
            "Type": "DOCUMENT",
            "SourceId": "src-001"
          }
        ],
        "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"
          }
        ]
      }
    ],
    "NextToken": "eyJvZmZzZXQiOjIwfQ"
  },
  "Code": "InvalidParameter",
  "Message": "The request parameters are invalid",
  "MaxResults": 20
}

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.