文件
  • PDF

文件

  • PDF

# 文件

概述

该API用于管理WORKBOX服务的文件。

查询API

查询文件信息。

请求URL

GET https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/{fileId}

请求头

报头名称 概述
x-ncp-apigw-timestamp 以毫秒(Millisecond)为单位显示从1970年1月1日00:00:00世界协调时间(UTC)起经过的时间**
若与API Gateway服务器的时间差超过5分钟,则视为无效的请求**
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key 由NAVER Cloud Platform门户网站发放的Access Key ID值
x-ncp-iam-access-key:{Account Access Key}
x-ncp-apigw-signature-v2 利用Access Key ID值和Secret Key加密的签名
x-ncp-apigw-signature-v2:{API Gateway Signature}
x-ncp-workbox-loginId WORKBOX服务登录邮件地址
x-ncp-workbox-loginId:{Login ID}
Content-Type 将请求体的Content-Type指定为application/json
Content-Type: application/json

请求路径参数

参数 类型 是否为必填 概述
fileId long Y 文件ID(FileId)

请求示例

GET https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/18614377

GET file-api/workbox-file-server/file-api/v1/files/18614377
HOST: workbox.apigw.ntruss.com
Content-Type: application/json
x-ncp-apigw-timestamp : 1649054672370
x-ncp-iam-access-key: toAvmFdP1rtPTMz2dpdy
x-ncp-apigw-signature-v2 : sks3TlqeoWnd08TkfdmfAjrdjTekRhRlAhRhWlvmeka=
x-ncp-workbox-loginId : gildong@sample.co.kr

响应示例

HTTP/1.1 200 OK
access-control-allow-credentials: true 
access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS 
access-control-max-age: 3600 
connection: keep-alive 
content-type: application/json;charset=UTF-8 
date: Tue, 05 Apr 2022 01:05:10 GMT 
server: nginx 
strict-transport-security: max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains 
transfer-encoding: chunked 
x-ncp-apigw-response-origin: ENDPOINT 
x-ncp-trace-id: 32p9p70p32pj36acph6com2p1g 
{
  "id": 18614377,
  "type": 2,
  "folderType": 1,
  "path": "gildong/naver.jpg",
  "uprFolderId": 2485554,
  "size": 5076,
  "creYmdt": "2022-04-05T01:04:32.185+0000",
  "modYmdt": "2022-04-05T01:04:32.000+0000",
  "allSubFoldersCount": 0,
  "allSubFilesCount": 0,
  "creator": {
    "userId": "bb891238-88cf-50f9-572e-9fe0111234a3",
    "userNm": "洪吉童",
    "userPhoto": null,
    "loginId": "gildong@sample.co.kr"
  },
  "modifier": {
    "userId": "bb891238-88cf-50f9-572e-9fe0111234a3",
    "userNm": "洪吉童",
    "userPhoto": null,
    "loginId": "gildong@sample.co.kr"
  },
  "uploadYmdt": "2022-04-05T01:04:32.000+0000",
  "userModYmdt": "2022-04-05T01:04:32.185+0000"
}

删除API

删除文件。

请求URL

DELETE https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/{fileId}

请求头

报头名称 概述
x-ncp-apigw-timestamp 以毫秒(Millisecond)为单位显示从1970年1月1日00:00:00世界协调时间(UTC)起经过的时间**
若与API Gateway服务器的时间差超过5分钟,则视为无效的请求**
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key 由NAVER Cloud Platform门户网站发放的Access Key ID值
x-ncp-iam-access-key:{Account Access Key}
x-ncp-apigw-signature-v2 利用Access Key ID值和Secret Key加密的签名
x-ncp-apigw-signature-v2:{API Gateway Signature}
x-ncp-workbox-loginId WORKBOX服务登录邮件地址
x-ncp-workbox-loginId:{Login ID}
Content-Type 将请求体的Content-Type指定为application/json
Content-Type: application/json

请求路径参数

参数 类型 是否为必填 概述
fileId Long Y 文件ID(FileId)

请求示例

DELETE https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/18629575

DELETE /file-api/workbox-file-server/file-api/v1/files/18629575
HOST: workbox.apigw.ntruss.com
Content-Type: application/json
x-ncp-apigw-timestamp : 1649054672370
x-ncp-iam-access-key: toAvmFdP1rtPTMz2dpdy
x-ncp-apigw-signature-v2 : sks3TlqeoWnd08TkfdmfAjrdjTekRhRlAhRhWlvmeka=
x-ncp-workbox-loginId : gildong@sample.co.kr

响应示例

HTTP/1.1 200 OK
access-control-allow-credentials: true 
access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS 
access-control-allow-origin: https://workbox.apigw.ntruss.com 
access-control-max-age: 3600 
connection: keep-alive 
content-length: 0 
date: Tue, 05 Apr 2022 06:10:21 GMT 
server: nginx 
strict-transport-security: max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains 
x-ncp-apigw-response-origin: ENDPOINT 
x-ncp-trace-id: 3copjc5i32opj3gd9i74sjgcr2 

修改API

修改文件名。

请求URL

PATCH https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/{fileId}

请求头

报头名称 概述
x-ncp-apigw-timestamp 以毫秒(Millisecond)为单位显示从1970年1月1日00:00:00世界协调时间(UTC)起经过的时间**
若与API Gateway服务器的时间差超过5分钟,则视为无效的请求**
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key 由NAVER Cloud Platform门户网站发放的Access Key ID值
x-ncp-iam-access-key:{Account Access Key}
x-ncp-apigw-signature-v2 利用Access Key ID值和Secret Key加密的签名
x-ncp-apigw-signature-v2:{API Gateway Signature}
x-ncp-workbox-loginId WORKBOX服务登录邮件地址
x-ncp-workbox-loginId:{Login ID}
Content-Type 将请求体的Content-Type指定为application/json
Content-Type: application/json

请求路径参数

参数 类型 是否为必填 概述
fileId Long Y 文件ID(FileId)

请求查询参数

参数 类型 是否为必填 概述
newName String Y 拟变更的名称

请求示例

PATCH https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/18614377?newName=test_newName_0001

PATCH /file-api/workbox-file-server/file-api/v1/files/18614377?newName=test_newName_0001
HOST: workbox.apigw.ntruss.com
Content-Type: application/json
x-ncp-apigw-timestamp : 1649054672370
x-ncp-iam-access-key: toAvmFdP1rtPTMz2dpdy
x-ncp-apigw-signature-v2 : sks3TlqeoWnd08TkfdmfAjrdjTekRhRlAhRhWlvmeka=
x-ncp-workbox-loginId : gildong@sample.co.kr

响应示例

HTTP/1.1 200 OK
 access-control-allow-credentials: true 
 access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS 
 access-control-allow-origin: https://workbox.apigw.ntruss.com 
 access-control-max-age: 3600 
 connection: keep-alive 
 content-length: 0 
 date: Tue, 05 Apr 2022 04:18:02 GMT 
 server: nginx 
 strict-transport-security: max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains 
 x-ncp-apigw-response-origin: ENDPOINT 
 x-ncp-trace-id: 32c1o75hmae1j68c1p6oom4d1j 

下载文件API

下载文件。

请求URL

GET https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/{fileId}/download

请求头

报头名称 概述
x-ncp-apigw-timestamp 以毫秒(Millisecond)为单位显示从1970年1月1日00:00:00世界协调时间(UTC)起经过的时间**
若与API Gateway服务器的时间差超过5分钟,则视为无效的请求**
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key 由NAVER Cloud Platform门户网站发放的Access Key ID值
x-ncp-iam-access-key:{Account Access Key}
x-ncp-apigw-signature-v2 利用Access Key ID值和Secret Key加密的签名
x-ncp-apigw-signature-v2:{API Gateway Signature}
x-ncp-workbox-loginId WORKBOX服务登录邮件地址
x-ncp-workbox-loginId:{Login ID}
Content-Type 将请求体的Content-Type指定为application/json
Content-Type: application/json

请求路径参数

参数 类型 是否为必填 概述
fileId Long Y 文件ID(FileId)

请求示例

GET https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/18618459/download

GET /file-api/workbox-file-server/file-api/v1/files/18618459/download
HOST: workbox.apigw.ntruss.com
Content-Type: application/json
x-ncp-apigw-timestamp : 1649054672370
x-ncp-iam-access-key: toAvmFdP1rtPTMz2dpdy
x-ncp-apigw-signature-v2 : sks3TlqeoWnd08TkfdmfAjrdjTekRhRlAhRhWlvmeka=
x-ncp-workbox-loginId : gildong@sample.co.kr

响应示例

HTTP/1.1 200 OK
access-control-allow-credentials: true 
access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS 
access-control-max-age: 3600 
connection: keep-alive 
content-disposition: attachment;filename*=UTF-8''naver.jpg 
content-length: 5076 
content-type: image/jpeg 
date: Tue, 05 Apr 2022 04:26:42 GMT 
server: nginx 
strict-transport-security: max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains 
x-ncp-apigw-response-origin: ENDPOINT 
x-ncp-trace-id: 3gp326tj38pho38ohp6os38opm 
下载文件

上传文件API

将文件上传到特定文件夹。

请求URL

POST https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files

请求头

报头名称 概述
x-ncp-apigw-timestamp 以毫秒(Millisecond)为单位显示从1970年1月1日00:00:00世界协调时间(UTC)起经过的时间**
若与API Gateway服务器的时间差超过5分钟,则视为无效的请求**
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key 由NAVER Cloud Platform门户网站发放的Access Key ID值
x-ncp-iam-access-key:{Account Access Key}
x-ncp-apigw-signature-v2 利用Access Key ID值和Secret Key加密的签名
x-ncp-apigw-signature-v2:{API Gateway Signature}
x-ncp-workbox-loginId WORKBOX服务登录邮件地址
x-ncp-workbox-loginId:{Login ID}
Content-Type 将请求体的Content-Type指定为multipart/form-data
Content-Type: multipart/form-data

请求查询参数

参数 类型 是否为必填 概述
action int Y 1:Nomal 2:Overwrite 3:Rename
size int Y 文件大小
actionForm formData N 通过form传递时使用的formData
file formData Y 拟上传的文件

请求示例

POST https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files?action=1&folderId=2485554&size=5076

POST /file-api/workbox-file-server/file-api/v1/files?action=1&folderId=2485554&size=5076
HOST: workbox.apigw.ntruss.com
Content-Type: multipart/form-data
x-ncp-apigw-timestamp : 1649054672370
x-ncp-iam-access-key: toAvmFdP1rtPTMz2dpdy
x-ncp-apigw-signature-v2 : sks3TlqeoWnd08TkfdmfAjrdjTekRhRlAhRhWlvmeka=
x-ncp-workbox-loginId : gildong@sample.co.kr

响应示例

HTTP/1.1 200 OK
access-control-allow-credentials: true 
access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS 
access-control-allow-origin: https://workbox.apigw.ntruss.com 
access-control-max-age: 3600 
connection: keep-alive 
content-type: application/json;charset=UTF-8 
date: Tue, 05 Apr 2022 07:21:22 GMT 
server: nginx 
strict-transport-security: max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains 
transfer-encoding: chunked 
x-ncp-apigw-response-origin: ENDPOINT 
x-ncp-trace-id: 62d9icpgj0pj338cb264qjie1i 
{
  "folderId": 2485554,
  "folderType": 1,
  "fileType": "jpg",
  "creYmdt": "2022-04-05T07:21:21.923+0000",
  "modYmdt": "2022-04-05T07:21:21.923+0000",
  "folderNm": "gildong001",
  "folderPath": "gildong001",
  "creator": {
    "userId": "bb891238-88cf-50f9-572e-9fe0111234a3",
    "userNm": "洪吉童",
    "userPhoto": null,
    "loginId": "gildong@sample.co.kr"
  },
  "filePath": "gildong001/naver.jpg",
  "sharedMemberCount": 0,
  "sharedMembers": null,
  "userModYmdt": "2022-04-05T07:21:21.923+0000",
  "id": 18637745,
  "name": "naver.jpg",
  "size": 5076,
  "userModYmdtMills": 1649143281923
}

复制文件API

将文件复制到特定文件夹。

请求URL

POST https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/copy-batch

请求头

报头名称 概述
x-ncp-apigw-timestamp 以毫秒(Millisecond)为单位显示从1970年1月1日00:00:00世界协调时间(UTC)起经过的时间**
若与API Gateway服务器的时间差超过5分钟,则视为无效的请求**
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key 由NAVER Cloud Platform门户网站发放的Access Key ID值
x-ncp-iam-access-key:{Account Access Key}
x-ncp-apigw-signature-v2 利用Access Key ID值和Secret Key加密的签名
x-ncp-apigw-signature-v2:{API Gateway Signature}
x-ncp-workbox-loginId WORKBOX服务登录邮件地址
x-ncp-workbox-loginId:{Login ID}
Content-Type 将请求体的Content-Type指定为application/json
Content-Type: application/json

请求体参数

参数 类型 是否为必填 概述
files List<FileItem> Y 文件信息

请求示例

POST https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/copy-batch

POST /file-api/workbox-file-server/file-api/v1/files/copy-batch
HOST: workbox.apigw.ntruss.com
Content-Type: application/json
x-ncp-apigw-timestamp : 1649054672370
x-ncp-iam-access-key: toAvmFdP1rtPTMz2dpdy
x-ncp-apigw-signature-v2 : sks3TlqeoWnd08TkfdmfAjrdjTekRhRlAhRhWlvmeka=
x-ncp-workbox-loginId : gildong@sample.co.kr
{
  "files": [
    {
      "action": 1,
      "destFolderId": 2486666,
      "id": 18637745
    },
{
      "action": 1,
      "destFolderId": 2486666,
      "id": 18614377
    }
  ]
}

响应示例

HTTP/1.1 200 OK
access-control-allow-credentials: true 
access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS 
access-control-allow-origin: https://workbox.apigw.ntruss.com 
access-control-max-age: 3600 
connection: keep-alive 
content-type: application/json;charset=UTF-8 
date: Tue, 05 Apr 2022 09:15:42 GMT 
server: nginx 
strict-transport-security: max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains 
transfer-encoding: chunked 
x-ncp-apigw-response-origin: ENDPOINT 
x-ncp-trace-id: 3cp9i65j66p9j6ae1gc8qjid31 
{
  "conflictContents": []
}

移动文件API

将文件移动到特定文件夹。

请求URL

POST https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/move-batch

请求头

报头名称 概述
x-ncp-apigw-timestamp 以毫秒(Millisecond)为单位显示从1970年1月1日00:00:00世界协调时间(UTC)起经过的时间**
若与API Gateway服务器的时间差超过5分钟,则视为无效的请求**
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key 由NAVER Cloud Platform门户网站发放的Access Key ID值
x-ncp-iam-access-key:{Account Access Key}
x-ncp-apigw-signature-v2 利用Access Key ID值和Secret Key加密的签名
x-ncp-apigw-signature-v2:{API Gateway Signature}
x-ncp-workbox-loginId WORKBOX服务登录邮件地址
x-ncp-workbox-loginId:{Login ID}
Content-Type 将请求体的Content-Type指定为application/json
Content-Type: application/json

请求体参数

参数 类型 是否为必填 概述
files List<FileItem> Y 文件信息
topMoveFolders List<Integer> N 拟移动的文件ID,通过拟移动到的目标文件夹ID配对并设置值

请求示例

POST https://workbox.apigw.ntruss.com/file-api/workbox-file-server/file-api/v1/files/move-batch

POST /file-api/workbox-file-server/file-api/v1/files/move-batch
HOST: workbox.apigw.ntruss.com
Content-Type: application/json
x-ncp-apigw-timestamp : 1649054672370
x-ncp-iam-access-key: toAvmFdP1rtPTMz2dpdy
x-ncp-apigw-signature-v2 : sks3TlqeoWnd08TkfdmfAjrdjTekRhRlAhRhWlvmeka=
x-ncp-workbox-loginId : gildong@sample.co.kr
{
  "files": [
    {
      "action": 1,
      "destFolderId": 2485768,
      "id": 18651018
    },
    {
      "action": 1,
      "destFolderId": 2485768,
      "id": 18651017
    }
  ],
"topMoveFolders":[18651018, 2485768, 18651017, 2485768]  
}

响应示例

HTTP/1.1 200 OK
access-control-allow-credentials: true 
access-control-allow-methods: GET,POST,PUT,DELETE,OPTIONS 
access-control-allow-origin: https://workbox.apigw.ntruss.com 
access-control-max-age: 3600 
connection: keep-alive 
content-type: application/json;charset=UTF-8 
date: Wed, 06 Apr 2022 01:58:27 GMT 
server: nginx 
strict-transport-security: max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains 
transfer-encoding: chunked 
x-ncp-apigw-response-origin: ENDPOINT 
x-ncp-trace-id: 30e9h6hgjadb230e31c8qj8c1p 
{
  "conflictContents": [],
  "topMoveFolders": [
    18651018,
    2485768,
    18651017,
    2485768
  ]
}

响应

返回HTTP状态代码,通过响应体信息进行传递。

HTTP状态代码 响应消息 概述
200 OK 常规请求成功
201 Created 资源创建成功时返回的响应代码
400 Bad Request 用于常规请求失败(一般用于响应服务器无法理解的请求)
500 Internal Server Error - 发生常规服务器错误时返回的响应代码
4XX类的错误代码表示客户端发生错误,
5XX类的错误代码则表示服务器端发生错误

操作

代码 概述
1 Nomal(跳过)默认值
2 Overwrite(覆盖)
3 Rename(重命名)

FileItem

参数 类型 是否为必填 概述
id long Y 文件ID
destFolderId Long Y 已复制文件所在的文件夹ID,设置为0时为一级文件夹
action int N 操作

本文是否有帮助

What's Next