UserService · UserService_ImportMemos
访问权限
仅限所有者:路径中的用户必须是已认证调用者;实例管理员身份不允许在此代替其他账号操作。
导入前先验证
分块上传 Memos 导出 ZIP:以 spec.totalSize 和 writeOffset "0" 开始,再使用 uploadId、committedSize 与 Base64 data 继续。首次结束时设置 validateOnly: true,获得计划而不导入。归档保持暂存,之后以 finishWrite: true 且不带 validateOnly 的调用执行导入。请检查冲突策略:未指定表示 SKIP,REPLACE 修改已有的自有笔记,DUPLICATE 创建副本。报告可能包含单项失败与警告,HTTP 成功不等于每条笔记均导入成功。每块上限 2 MiB,会话闲置 30 分钟或服务重启后失效。
请求
ImportMemos uploads a Memos export file in bounded chunks and imports it into the user's memos. The first call carries the spec and returns an upload_id; later calls carry that upload_id. A finishing call with validate_only returns the plan and keeps the archive staged; a finishing call without it imports and returns the report. Uploads are bound to the authenticated user, expire after 30 minutes of inactivity, and do not survive a server restart.
/api/v1/users/{user}:importMemos参数
| 名称 / 位置 | 类型 / 是否必需 | 描述 |
|---|---|---|
userpath | string 必需 | The user id. |
请求体
必需
application/json · ImportMemosRequest
响应
200 · OK
application/json · ImportMemosResponse
default · Default error response
application/json · Status
完整操作定义
下方保留全部已声明约束、媒体类型和响应细节。结构引用链接到完整定义。
展开 JSON 定义
{
"tags": [
"UserService"
],
"description": "ImportMemos uploads a Memos export file in bounded chunks and imports it into\n the user's memos. The first call carries the spec and returns an\n upload_id; later calls carry that upload_id. A finishing call with\n validate_only returns the plan and keeps the archive staged; a finishing\n call without it imports and returns the report. Uploads are bound to the\n authenticated user, expire after 30 minutes of inactivity, and do not\n survive a server restart.",
"operationId": "UserService_ImportMemos",
"parameters": [
{
"name": "user",
"in": "path",
"description": "The user id.",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImportMemosRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImportMemosResponse"
}
}
}
},
"default": {
"description": "Default error response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Status"
}
}
}
}
}
}