Help Center/ KooDrive/ API Reference/ API/ File Management/ Obtaining Download Links
Updated on 2024-07-30 GMT+08:00

Obtaining Download Links

Function

Obtain the download links of files.

URI

POST /koodrive/ose/v1/files/download

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Authorization

Yes

String

Access token. Token authentication is used to call KooDrive APIs. A token indicates the permission. When an API is called, the token is added to the request header to obtain the operation permission. For details about how to obtain an access token, see the corresponding developer guide. The format is Bearer+{access_token}.

X-Traceid

No

String

Message log trace ID. The value contains 58 bits.

language

No

String

Language code, which complies with the internationalization specifications. For example, en-US indicates English (United States). English (United States) is used by default.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

containerId

Yes

String

ID of the space where the files to be obtained are located.

fileIds

Yes

Array of strings

File ID list. Up to 100 file IDs are allowed.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

code

Integer

Response code.

msg

String

Response information.

batchCode

Integer

Response code.

  • 0: partially successful.

  • 1: all successful.

  • 2: all failed.

downloads

Array of DownloadInfoResponse objects

Download link information.

Table 4 DownloadInfoResponse

Parameter

Type

Description

fileId

String

File ID.

fileName

String

File name.

url

String

Download link.

code

String

Response code of a single download record.

msg

String

Response message of a single download record.

Example Requests

Obtains the download links of files.

POST /koodrive/ose/v1/files/download

Authorization:Bearer+10f88*********4791e9ff

{
  "containerId": "IAADfsBFCO6WtAtuA9add2fea594e4e75b8feb8474ef236",
  "fileIds": [
    "Fn1bTLIOomJkTCAe9DEVBRY4U6IkuqkMZ"
  ]
}

Example Responses

Status code: 200

Response to the request for obtaining the file download links.

{
  "downloads" : [ {
    "fileId" : "Fn1bTLIOomJkTCAe9DEVBRY4U6IkuqkMZ",
    "url" : "https://b10-obs-ykj-uat-01.obs.cidc-rp-2006.joint.cmecloud.cn/5e3fc0c5d4fa45338f44db7177579c2c087?response-content-disposition=attachment%3B%20filename%3D%22%25E5%258F%2591%25E7%25A5%25A81.pdf%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20231227T072939Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=MKRISPBZAJWFHNBJ5WLB%2F20231227%2Fcidc-rp-2006%2Fs3%2Faws4_request&X-Amz-Signature=9d06798af17e2f1082b720f43af29a32b3154da4ddeee4f10025a758b599728a",
    "fileName" : "Invoice 1.pdf",
    "code" : "0",
    "msg" : "success"
  } ],
  "batchCode" : 1,
  "code" : 0,
  "msg" : "Success."
}

Status Codes

Status Code

Description

200

Response to the request for obtaining the file download links.