Skip to content

获取关系概览 ​

接口说明 ​

读取知识库文件关系的简要概览。

接口信息 ​

字段值
方法GET
路径/openapi/v2/knowledge-bases/{knowledgeBaseId}/graph/overview
Operation IDgetGraphOverview
鉴权Bearer OpenAPI key

入参 ​

名称位置必填类型示例说明
knowledgeBaseIdpath是stringknowledge-base-11111111-1111-4111-8111-111111111111知识库 API 返回的知识库标识。

请求体 ​

这个接口没有请求体。

请求示例 ​

bash
curl -X GET "https://openapi.example.com/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/graph/overview" \
  -H "Authorization: Bearer <openapi-key>"

成功响应 ​

200 ​

返回当前可读取知识库版本的文件关系数量和继续探索链接。

字段必填类型说明
activeContentRevision是integer当前可读取知识库内容的修订号。
availability是available | empty | unavailable当前可读取知识库版本是否包含可读取的关系数据。空结果不表示知识库为空。
summary是object当前文件关系的节点、边和质量摘要。
resources是object可继续读取的关系文件和接口链接。
readActions是object用于读取文件或继续探索文件关系的 Developer OpenAPI 链接。

成功响应示例 ​

json
{
  "activeContentRevision": 1,
  "availability": "available",
  "summary": {
    "readableFileCount": 24,
    "relationshipCount": 18
  },
  "resources": {
    "graphIndexPath": "_graph/index.md",
    "byDirectoryPath": "_graph/by-directory",
    "byFilePath": "_graph/by-file"
  },
  "readActions": {
    "graphIndexContent": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/files/content?path=_graph%2Findex.md",
    "listGraphRoot": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/tree?parentPath=_graph",
    "listRelationshipsByDirectory": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/tree?parentPath=_graph%2Fby-directory",
    "listRelationshipsByFile": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/tree?parentPath=_graph%2Fby-file"
  }
}

错误码 ​

下表列出这个接口已声明的全部错误响应。

HTTP 状态错误码说明
401UNAUTHORIZEDBearer API key 缺失、格式错误、未知、已撤销或已删除。
404NOT_FOUND请求的资源不存在。
429RATE_LIMITED请求超过当前配置的速率限制。
500INTERNAL_ERRORAPI 遇到内部错误。
503DATABASE_REPOSITORY_UNAVAILABLE当前接口所需的数据暂时不可用。

后续操作 ​