MemoService · MemoService_UpdateMemo
当 updateMask 包含 attachments 时,提交列表会替换完整附件集合。未包含的附件会被删除,并执行存储清理。对于已有 APPLE_LIVE_PHOTO 配对,只保留一个成员可能在更新通过正文引用校验后删除两者,包括明确要求保留的成员;应保留完整配对,或有意同时移除。正文修改也必须与受管理图片引用保持一致。更新这些字段前,请先阅读附件集合替换操作。
访问权限
需要笔记作者或实例管理员。更新与分享管理还会检查适用的空间归属;空间成员资格本身不会赋予他人笔记的所有者权限。
只更新目标字段
发送 Memo 形状的 JSON 请求体和显式 updateMask。支持的路径包括 content、visibility、space、pinned、state、create_time、update_time、location、attachments 与 relations。服务端不会在每次编辑时自动刷新 updateTime;需要更新时间时将 update_time 加入掩码。改变 SPACE 笔记的归属时必须显式指定可见性。设为 SPACE 前需要移除有效分享授权。示例仅修改 content;MEMO_ID 是已拥有笔记资源名的末尾片段。
curl --fail-with-body -X PATCH \
-H "Authorization: Bearer $MEMOS_TOKEN" \
-H "Content-Type: application/json" \
--data '{"content":"Updated API test memo"}' \
"$MEMOS_URL/api/v1/memos/$MEMO_ID?updateMask=content"完整保留已有 Live Photo 配对
替换附件集合时,如果只提交已有 APPLE_LIVE_PHOTO 配对中的一个成员,会从请求集合中移除整组,包括提交的那个成员。若正文引用校验通过且更新继续,两者都将被删除。应保留两者的完整附件资源名,或有意同时移除。此行为不同于 DeleteAttachment 和 BatchDeleteAttachments,后两者会拒绝部分分组。写入响应丢失后,重试前先核对当前附件集合。
请求
UpdateMemo updates a memo.
/api/v1/memos/{memo}参数
| 名称 / 位置 | 类型 / 是否必需 | 描述 |
|---|---|---|
memopath | string 必需 | The memo id. |
updateMaskquery | string (field-mask) 必需(接口描述) | Required. The list of fields to update. |
请求体
必需
application/json · Memo
响应
200 · OK
application/json · Memo
default · Default error response
application/json · Status
完整操作定义
下方保留全部已声明约束、媒体类型和响应细节。结构引用链接到完整定义。
展开 JSON 定义
{
"tags": [
"MemoService"
],
"description": "UpdateMemo updates a memo.",
"operationId": "MemoService_UpdateMemo",
"parameters": [
{
"name": "memo",
"in": "path",
"description": "The memo id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "updateMask",
"in": "query",
"description": "Required. The list of fields to update.",
"schema": {
"type": "string",
"format": "field-mask"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Memo"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Memo"
}
}
}
},
"default": {
"description": "Default error response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Status"
}
}
}
}
}
}