附件處理

跨模組通用的功能,可管理系統附件,包括:附件上傳、附件下載、附件刪除。

附件上傳

post

使用說明,以表單申請要加入附件舉例:

  • 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
成功
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

刪除已上傳的附件

post
Authorizations
Body
uuidstringRequired

FILE UUID

Responses
200
成功
post
POST /api/file/detach HTTP/1.1
Host: 
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "uuid": "text"
}

No content

下載附件

post
Authorizations
Body
uuidstringRequired

FILE UUID

Responses
200
成功
post
POST /api/file/download HTTP/1.1
Host: 
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 15

{
  "uuid": "text"
}

No content