AttachmentService · AttachmentService_UpdateAttachment
基于协议生成的参考。授权与实例策略仍然生效。结构描述继承自 MIT 许可的应用接口定义;本站不会向真实服务执行示例。
访问权限
需要附件所有者或实例管理员;关联附件还要求有权管理所属笔记,并满足归属检查。
这里只能修改 filename
实现要求非空 updateMask,但只应用 filename。其他掩码路径不会替换内容、重新关联 memo 或编辑媒体元数据。修改关联集合应使用笔记附件操作;替换字节应创建新附件。请使用 updateMask=filename,并在请求体中提供新 filename。
请求
UpdateAttachment updates an attachment.
PATCH
/api/v1/attachments/{attachment}参数
| 名称 / 位置 | 类型 / 是否必需 | 描述 |
|---|---|---|
attachmentpath | string 必需 | The attachment id. |
updateMaskquery | string (field-mask) 必需(接口描述) | Required. The list of fields to update. |
请求体
必需
application/json · Attachment
响应
200 · OK
application/json · Attachment
default · Default error response
application/json · Status
完整操作定义
下方保留全部已声明约束、媒体类型和响应细节。结构引用链接到完整定义。
展开 JSON 定义
{
"tags": [
"AttachmentService"
],
"description": "UpdateAttachment updates an attachment.",
"operationId": "AttachmentService_UpdateAttachment",
"parameters": [
{
"name": "attachment",
"in": "path",
"description": "The attachment 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/Attachment"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Attachment"
}
}
}
},
"default": {
"description": "Default error response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Status"
}
}
}
}
}
}