上传单个 Markdown 文件
接口说明
为一个状态为 upload_required 的文件上传完整 Markdown 正文。
接口信息
| 字段 | 值 |
|---|---|
| 方法 | PUT |
| 路径 | /openapi/v2/knowledge-bases/{knowledgeBaseId}/upload-sessions/{uploadSessionId}/entries/{entryId}/content |
| Operation ID | uploadSessionEntryContent |
| 鉴权 | Bearer OpenAPI key |
入参
| 名称 | 位置 | 必填 | 类型 | 示例 | 说明 |
|---|---|---|---|---|---|
knowledgeBaseId | path | 是 | string | knowledge-base-11111111-1111-4111-8111-111111111111 | 知识库 API 返回的知识库标识。 |
uploadSessionId | path | 是 | string | upload-11111111-1111-4111-8111-111111111111 | 创建上传会话后返回的会话标识。 |
entryId | path | 是 | string | upload-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 状态 | 错误码 | 说明 |
|---|---|---|
| 401 | UNAUTHORIZED | Bearer API key 缺失、格式错误、未知、已撤销或已删除。 |
| 404 | NOT_FOUND | 请求的资源不存在。 |
| 409 | CONFLICT | 请求与资源当前状态冲突。 |
| 413 | PAYLOAD_TOO_LARGE | 请求体或待读取文件超过当前接口允许的大小。 |
| 422 | VALIDATION_ERROR | 请求未通过校验。 |
| 429 | RATE_LIMITED | 请求超过当前配置的速率限制。 |
| 500 | INTERNAL_ERROR | API 遇到内部错误。 |
| 503 | DATABASE_REPOSITORY_UNAVAILABLE | 当前接口所需的数据暂时不可用。 |