标准上传 API 文档

使用标准 HTTP API 与 Telegram 存储交互的完整指南

基本文件操作
标准 API 支持的基本文件操作

获取文件列表

请求: GET /api/files

认证: Bearer Token(可选,未认证时只返回公开文件)

响应: 文件对象数组

[
  {
    "id": "uuid-string",
    "filename": "example.jpg",
    "size": 1024000,
    "contentType": "image/jpeg",
    "isChunked": false,
    "uploadComplete": true,
    "createdAt": "2023-01-01T00:00:00Z",
    "updatedAt": "2023-01-01T00:00:00Z"
  }
]

上传单个文件

请求: POST /api/files

认证: Bearer Token(必需)

Content-Type: multipart/form-data

请求体: 包含 file 字段的表单数据

响应: 上传成功的文件对象

{
  "id": "uuid-string",
  "filename": "example.jpg",
  "size": 1024000,
  "contentType": "image/jpeg",
  "isChunked": false,
  "uploadComplete": true,
  "createdAt": "2023-01-01T00:00:00Z",
  "updatedAt": "2023-01-01T00:00:00Z"
}

下载文件

请求: GET /api/files/{fileId}

认证: Bearer Token(可选,未认证时只能下载公开文件)

响应: 文件二进制数据,带有适当的 Content-Type 和 Content-Disposition 头

删除文件

请求: DELETE /api/files/{fileId}

认证: Bearer Token(必需)

响应: 成功状态

{
  "success": true
}