Files
full/wiki/api/16-fts-rest.md

34 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# FTS REST API
文件上传与文件服务配置。基础路径:`/rest/fts`
## 路由
| 方法 | 路径 | 鉴权 | 请求 | 说明 |
|---|---|---|---|---|
| GET | `/rest/fts/ping` | 否 | 无 | 健康检查,返回 Pong |
| GET | `/rest/fts/config` | 否 | 无 | 获取上传字段、大小和扩展名限制 |
| POST | `/rest/fts/uploader` | JWT | `multipart/form-data` | 上传文件到 local 或 MinIO |
## 上传文件
```http
POST /rest/fts/uploader
Authorization: <JWT>
Content-Type: multipart/form-data
```
| 表单字段 | 类型 | 必填 | 说明 |
|---|---|---:|---|
| `provider` | string | 是 | `local``minio`,服务端转为小写 |
| `bucket` | string | 是 | 存储桶或本地目录分类,服务端转为小写 |
| `file` | file | 是 | 默认字段名;实际由配置 `Fts.FtsConfig.InputKey` 决定 |
服务端校验文件大小和扩展名,计算 SHA-256并保存文件记录。默认开发配置最大 5 GiB允许的扩展名见 `/rest/fts/config`
成功数据为文件记录,常用字段:`identity``name``ext``size``hash``status` 以及最终访问地址。响应使用项目统一结构:
```json
{"code":0,"message":"success","data":{}}
```