Skip to content

数据上传 ​

tus上传数据

POST ①文件信息预保存 ​

POST /admin/data/upload

该接口存储上传数据的基础信息,调用该接口后,将在数据库保存数据的基础信息,随后可根据该接口返回的id调用分片上传初始化,分片上传文件进行文件上传操作。

Body 请求参数

yaml
bizType: "1"
fileName: 文件名.zip
cfgJson: '{"epsg":5555}'
isPublish: "0"
fileType: ""
foldersId: asdadad
projectId: a2e2341f5b35753902cc85905ae727d7

请求参数 ​

名称位置类型必选说明
Authorizationheaderstring是none
bodybodyobject否none
» bizTypebodystring是文件类型(1影像、2地形、3倾斜、4点云、5BIM...)
» fileNamebodystring是文件名,带后缀 urlencode编码
» cfgJsonbodystring是数据处理字段 urlencode编码
» isPublishbodystring是是否上传完成即发布 1是 0 否
» fileTypebodystring是文件类型
» foldersIdbodystring是上传到的所属文件夹,顶级为0
» projectIdbodystring否上传到项目下的所属项目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
}

返回结果 ​

状态码状态码含义说明数据模型
200OKnoneInline
500Internal Server ErrornoneInline

返回数据结构 ​

状态码 200

名称类型必选约束中文名说明
» codeintegertruenonenone
» msgnulltruenonenone
» dataobjecttruenonenone
»» idstringtruenone数据ID
»» namestringtruenone数据名称
»» bizTypeintegertruenone数据类型
»» fileNamestringtruenone文件名称
»» fileTypestringtruenone文件类型
»» fileSizenulltruenone文件大小
»» uploadUuidnulltruenonenone
»» uploadStartTimestringtruenonenone
»» uploadFinishTimenulltruenonenone
»» storagePathstringtruenonenone
»» sourcePathnulltruenonenone
» okbooleantruenonenone

状态码 500

名称类型必选约束中文名说明
» codeintegertruenonenone
» msgstringtruenonenone
» datanulltruenonenone
» okbooleantruenonenone

POST ②分片上传初始化 ​

POST /admin/api/files/upload

基于TUS协议,根据返回header的location进行上传文件的操作

请求参数 ​

名称位置类型必选说明
Authorizationheaderstring是凭证
dataIdheaderstring是数据ID
Tus-Resumableheaderstring是固定值
Upload-Lengthheaderstring是文件总大小
Upload-Metadataheaderstring是上传附属信息(folderId,dataId及projectId可按需传参)

返回示例

201 Response

返回结果 ​

状态码状态码含义说明数据模型
201CreatednoneInline

PATCH ③分片上传文件 ​

PATCH /admin/api/files/upload/

Body 请求参数

yaml
string

请求参数 ​

名称位置类型必选说明
idpathstring是分片上传初始化获取到的uploadUuid
dataIdheaderstring是none
Authorizationheaderstring是none
Tus-Resumableheaderstring是none
Upload-Offsetheaderstring是none
Content-Lengthheaderstring是none
Content-Typeheaderstring是none
bodybodystring(binary)否none

返回示例

406 Response

json
{
  "timestamp": "string",
  "status": 0,
  "error": "string",
  "path": "string"
}

返回结果 ​

状态码状态码含义说明数据模型
406Not AcceptablenoneInline

返回数据结构 ​

状态码 406

名称类型必选约束中文名说明
» timestampstringtruenonenone
» statusintegertruenonenone
» errorstringtruenonenone
» pathstringtruenonenone

Released under the MIT License.