上传并校验文件 接口手册.md 2.3 KB

上传并校验文件 接口手册

上传文件到dms-》验证文件可用性-》返回验证结果及文件访问路径

接口地址:POST http://121.43.55.7:10026/shenqin/uploadAndVerify
认证方式:Header token
请求类型:multipart/form-data

请求头

Header 必填 说明
token 是
Content-Type 是 multipart/form-data

请求参数(form-data)

参数 类型 必填 说明 示例
file File 是 上传文件
columnId string 是 1743
fileType string 是 可选:docx、pdf pdf

请求示例

curl --location --request POST 'http://121.43.55.7:10026/shenqin/uploadAndVerify' \
--header 'token: ' \
--header 'Content-Type: multipart/form-data' \
--form 'file=@"<文件路径>"' \
--form 'columnId="1743"' \
--form 'fileType="pdf"'

成功响应示例

{
    "code": 200,
    "message": "成功",
    "content": {
        "valid": true,
        "file_role": "REFERENCE_BID",
        "filename": "1743-file-89090312-3956-42c4-8155-4f10833c4d61.pdf",
        "size": 1576446,
        "sha256": "aa0e543ed653629419cfd2474b88b9f7b888ef9ebef8cb90d189318347223f8a",
        "file_type": "pdf",
        "is_text_pdf": true,
        "filePath": "/static/file/1743-file-89090312-3956-42c4-8155-4f10833c4d61.pdf",
        "resolved_path": "/root/dms_upload/file/1743-file-89090312-3956-42c4-8155-4f10833c4d61.pdf",
        "message": "文件检测通过"
    }
}

业务错误码

code 说明
400 参数异常
401 文件不可用
402 文件和实际类型不符合
403 文件不是含有文字的PDF

响应字段说明

字段 类型 说明
code int 业务状态码
message string 业务消息
content.filePath string 文件网络访问路径,uploadFile的返回
content.valid boolean 文件是否校验通过
content.file_role string 文件角色
content.filename string 服务端文件名
content.size int 文件大小(字节)
content.sha256 string 文件 SHA-256
content.file_type string 文件类型
content.is_text_pdf boolean 是否文本型 PDF
content.resolved_path string 服务器存储路径
content.message string 检测消息