Skip to content

上传单个 Markdown 文件 ​

接口说明 ​

为一个状态为 upload_required 的文件上传完整 Markdown 正文。

接口信息 ​

字段值
方法PUT
路径/openapi/v2/knowledge-bases/{knowledgeBaseId}/upload-sessions/{uploadSessionId}/entries/{entryId}/content
Operation IDuploadSessionEntryContent
鉴权Bearer OpenAPI key

入参 ​

名称位置必填类型示例说明
knowledgeBaseIdpath是stringknowledge-base-11111111-1111-4111-8111-111111111111知识库 API 返回的知识库标识。
uploadSessionIdpath是stringupload-11111111-1111-4111-8111-111111111111创建上传会话后返回的会话标识。
entryIdpath是stringupload-entry-11111111-1111-4111-8111-111111111111上传文件记录标识。

请求体 ​

text/markdown ​

数据结构: string

所选上传项的完整 Markdown 正文。

请求示例 ​

bash
curl -X PUT "https://openapi.example.com/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/upload-sessions/upload-11111111-1111-4111-8111-111111111111/entries/upload-entry-11111111-1111-4111-8111-111111111111/content" \
  -H "Authorization: Bearer <openapi-key>" \
  -H "Content-Type: text/markdown" \
  --data-binary "# Guide\n\nCurrent onboarding guidance."

成功响应 ​

200 ​

返回收到 Markdown 正文后的上传项。

字段必填类型说明
entry是object本次上传的文件项。

成功响应示例 ​

json
{
  "entry": {
    "id": "upload-entry-11111111-1111-4111-8111-111111111111",
    "relativePath": "handbook/onboarding/guide.md",
    "directoryPath": "handbook/onboarding",
    "name": "guide.md",
    "declaredSize": 37,
    "receivedSize": 37,
    "disposition": "upload_required",
    "transferState": "uploaded",
    "sourceFileId": "source-file-11111111-1111-4111-8111-111111111111",
    "existingResourceRevision": null
  }
}

错误码 ​

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

HTTP 状态错误码说明
401UNAUTHORIZEDBearer API key 缺失、格式错误、未知、已撤销或已删除。
404NOT_FOUND请求的资源不存在。
409CONFLICT请求与资源当前状态冲突。
413PAYLOAD_TOO_LARGE请求体或待读取文件超过当前接口允许的大小。
422VALIDATION_ERROR请求未通过校验。
429RATE_LIMITED请求超过当前配置的速率限制。
500INTERNAL_ERRORAPI 遇到内部错误。
503DATABASE_REPOSITORY_UNAVAILABLE当前接口所需的数据暂时不可用。

后续操作 ​