数据上传
tus上传数据
POST ①文件信息预保存
POST /admin/data/upload
该接口存储上传数据的基础信息,调用该接口后,将在数据库保存数据的基础信息,随后可根据该接口返回的id调用分片上传初始化,分片上传文件进行文件上传操作。
Body 请求参数
yaml
bizType: "1"
fileName: 文件名.zip
cfgJson: '{"epsg":5555}'
isPublish: "0"
fileType: ""
foldersId: asdadad
projectId: a2e2341f5b35753902cc85905ae727d7请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| Authorization | header | string | 是 | none |
| body | body | object | 否 | none |
| » bizType | body | string | 是 | 文件类型(1影像、2地形、3倾斜、4点云、5BIM...) |
| » fileName | body | string | 是 | 文件名,带后缀 urlencode编码 |
| » cfgJson | body | string | 是 | 数据处理字段 urlencode编码 |
| » isPublish | body | string | 是 | 是否上传完成即发布 1是 0 否 |
| » fileType | body | string | 是 | 文件类型 |
| » foldersId | body | string | 是 | 上传到的所属文件夹,顶级为0 |
| » projectId | body | string | 否 | 上传到项目下的所属项目ID |
返回示例
json
{
"code": 0,
"msg": null,
"data": {
"id": "d4e31b1dfc69fe7e86a5e82701b909b4",
"name": "图新说-20241211-165523.zip",
"bizType": 1,
"fileName": "图新说-20241211-165523.zip",
"fileType": "zip",
"fileSize": null,
"fileMd5": null,
"status": 10,
"thumbnail": null,
"uploadUuid": null,
"uploadStartTime": "2025-01-10 09:37:40",
"uploadFinishTime": null,
"processStartTime": null,
"processFinishTime": null,
"storagePath": "dataCenter/uploads/d4e31b1dfc69fe7e86a5e82701b909b4/data.zip",
"sourcePath": null,
"remark": null,
"dataGroupId": null,
"createBy": "admin",
"createTime": "2025-01-10 09:37:40",
"updateBy": "admin",
"updateTime": "2025-01-10 09:37:40",
"delFlag": "0",
"tenantId": null,
"errorReason": null,
"isPublish": 0,
"metadataInfo": null,
"folderId": null,
"projectId": null
},
"ok": true
}500 Response
json
{
"code": 0,
"msg": "string",
"data": null,
"ok": true
}返回结果
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 200 | OK | none | Inline |
| 500 | Internal Server Error | none | Inline |
返回数据结构
状态码 200
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » code | integer | true | none | none | |
| » msg | null | true | none | none | |
| » data | object | true | none | none | |
| »» id | string | true | none | 数据ID | |
| »» name | string | true | none | 数据名称 | |
| »» bizType | integer | true | none | 数据类型 | |
| »» fileName | string | true | none | 文件名称 | |
| »» fileType | string | true | none | 文件类型 | |
| »» fileSize | null | true | none | 文件大小 | |
| »» uploadUuid | null | true | none | none | |
| »» uploadStartTime | string | true | none | none | |
| »» uploadFinishTime | null | true | none | none | |
| »» storagePath | string | true | none | none | |
| »» sourcePath | null | true | none | none | |
| » ok | boolean | true | none | none |
状态码 500
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » code | integer | true | none | none | |
| » msg | string | true | none | none | |
| » data | null | true | none | none | |
| » ok | boolean | true | none | none |
POST ②分片上传初始化
POST /admin/api/files/upload
基于TUS协议,根据返回header的location进行上传文件的操作
请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| Authorization | header | string | 是 | 凭证 |
| dataId | header | string | 是 | 数据ID |
| Tus-Resumable | header | string | 是 | 固定值 |
| Upload-Length | header | string | 是 | 文件总大小 |
| Upload-Metadata | header | string | 是 | 上传附属信息(folderId,dataId及projectId可按需传参) |
返回示例
201 Response
返回结果
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 201 | Created | none | Inline |
PATCH ③分片上传文件
PATCH /admin/api/files/upload/
Body 请求参数
yaml
string请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| id | path | string | 是 | 分片上传初始化获取到的uploadUuid |
| dataId | header | string | 是 | none |
| Authorization | header | string | 是 | none |
| Tus-Resumable | header | string | 是 | none |
| Upload-Offset | header | string | 是 | none |
| Content-Length | header | string | 是 | none |
| Content-Type | header | string | 是 | none |
| body | body | string(binary) | 否 | none |
返回示例
406 Response
json
{
"timestamp": "string",
"status": 0,
"error": "string",
"path": "string"
}返回结果
| 状态码 | 状态码含义 | 说明 | 数据模型 |
|---|---|---|---|
| 406 | Not Acceptable | none | Inline |
返回数据结构
状态码 406
| 名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
|---|---|---|---|---|---|
| » timestamp | string | true | none | none | |
| » status | integer | true | none | none | |
| » error | string | true | none | none | |
| » path | string | true | none | none |