附件處理
跨模組通用的功能,可管理系統附件,包括:附件上傳、附件下載、附件刪除。
使用說明,以表單申請要加入附件舉例:
step1. 打這個 API 取得回傳物件
step2. 把回傳物件 push 進表單申請的 attachments 陣列 回傳格式:
{
"fileUUID": "30381c3458faf2d31c38aed42e7c6e17",
"fileName": "1.png",
"fileSize": 74506,
"fileMime": "image/png",
"isTmp": 1
}
Authorizations
Body
funCodestringRequired
約定的功能代碼,例如:請假單="wf010"
attachmentstring · binaryRequired
multipart request 的 field name 必須是 'attachment'
Responses
200
成功
401
認證失敗 (請更新 accessToken 再試一次)
403
權限不足
440
參數錯誤 (請檢查 parameters 或 request body 的欄位、格式是否完整及正確)
450
MulterError `{ code: 450, msg?: string }`
500
系統異常 `{ code: 500, msg: string }`
post
POST /api/file/attach HTTP/1.1
Host:
Authorization: Bearer JWT
Content-Type: multipart/form-data
Accept: */*
Content-Length: 40
{
"funCode": "text",
"attachment": "binary"
}
No content
Authorizations
Body
uuidstringRequired
FILE UUID
Responses
200
成功
401
認證失敗 (請更新 accessToken 再試一次)
403
權限不足
440
參數錯誤 (請檢查 parameters 或 request body 的欄位、格式是否完整及正確)
500
系統異常 `{ code: 500, msg: string }`
post
POST /api/file/detach HTTP/1.1
Host:
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 15
{
"uuid": "text"
}
No content
Authorizations
Body
uuidstringRequired
FILE UUID
Responses
200
成功
401
認證失敗 (請更新 accessToken 再試一次)
403
權限不足
440
參數錯誤 (請檢查 parameters 或 request body 的欄位、格式是否完整及正確)
500
系統異常 `{ code: 500, msg: string }`
post
POST /api/file/download HTTP/1.1
Host:
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 15
{
"uuid": "text"
}
No content