Skip to content

获取上传目录 ​

接口说明 ​

读取一个上传目录及其文件数量。

接口信息 ​

字段值
方法GET
路径/openapi/v2/knowledge-bases/{knowledgeBaseId}/source-directories/{directoryId}
Operation IDgetSourceDirectory
鉴权Bearer OpenAPI key

入参 ​

名称位置必填类型示例说明
knowledgeBaseIdpath是stringknowledge-base-11111111-1111-4111-8111-111111111111知识库 API 返回的知识库标识。
directoryIdpath是stringdirectory-11111111-1111-4111-8111-111111111111目录或文件树接口返回的上传目录标识。

请求体 ​

这个接口没有请求体。

请求示例 ​

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

成功响应 ​

200 ​

返回指定的上传目录。

字段必填类型说明
directory是object上传目录记录。

成功响应示例 ​

json
{
  "directory": {
    "directoryId": "directory-11111111-1111-4111-8111-111111111111",
    "knowledgeBaseId": "knowledge-base-11111111-1111-4111-8111-111111111111",
    "parentDirectoryId": "directory-handbook",
    "name": "onboarding",
    "relativePath": "handbook/onboarding",
    "generatedPath": "pages/handbook/onboarding",
    "depth": 2,
    "resourceRevision": 1,
    "directFileCount": 1,
    "descendantFileCount": 1,
    "mutable": true,
    "deletable": true,
    "deleting": false,
    "actions": {
      "self": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/source-directories/directory-11111111-1111-4111-8111-111111111111",
      "children": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/source-directories?parentDirectoryId=directory-11111111-1111-4111-8111-111111111111",
      "sourceFiles": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/source-files?directoryId=directory-11111111-1111-4111-8111-111111111111",
      "generatedTree": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/tree?parentPath=pages%2Fhandbook%2Fonboarding"
    },
    "createdAt": "2026-06-17T00:00:00.000Z",
    "updatedAt": "2026-06-17T00:00:00.000Z"
  }
}

错误码 ​

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

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

后续操作 ​