文档API 参考

Rust · 0.1.0

Create Attachment

POST /api/v1/attachments

AttachmentService · AttachmentService_CreateAttachment

基于协议生成的参考。授权与实例策略仍然生效。结构描述继承自 MIT 许可的应用接口定义;本站不会向真实服务执行示例。

访问权限

需要有效账号认证;实例策略及下方操作特有的检查仍然适用。

通过 JSON 上传字节

直接发送 Attachment,包含 filename、MIME type 与 Base64 content。可选 memo 字段是完整笔记资源名,并要求有权管理该笔记。默认上传大小上限为 32 MiB,存储设置可改变它。创建返回元数据,content 仅用于输入。即使关联成功,即时响应也可能省略 memo 回链,可通过 GetAttachment 读取最终投影。

请求

CreateAttachment creates a new attachment.

POST/api/v1/attachments

参数

名称 / 位置类型 / 是否必需描述
attachmentId
query
string
OpenAPI 未标记为必需
Optional. The attachment ID to use for this attachment. If empty, a unique ID will be generated. Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$

请求体

必需

application/json · Attachment

响应

200 · OK

application/json · Attachment

default · Default error response

application/json · Status

完整操作定义

下方保留全部已声明约束、媒体类型和响应细节。结构引用链接到完整定义。

展开 JSON 定义
{
  "tags": [
    "AttachmentService"
  ],
  "description": "CreateAttachment creates a new attachment.",
  "operationId": "AttachmentService_CreateAttachment",
  "parameters": [
    {
      "name": "attachmentId",
      "in": "query",
      "description": "Optional. The attachment ID to use for this attachment.\n If empty, a unique ID will be generated.\n Format: ^[a-zA-Z0-9]([a-zA-Z0-9-]{0,34}[a-zA-Z0-9])?$",
      "schema": {
        "type": "string"
      }
    }
  ],
  "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"
          }
        }
      }
    }
  }
}