Help Center/KooDrive/API Reference(Carrier)/API/File Operations/Obtaining the Online Preview Link of a File
Updated on 2026-02-12 GMT+08:00

Obtaining the Online Preview Link of a File

Function

Obtain the online preview link of a file.

URI

GET /koodrive/ose/v1/files/preview/{fileId}/link

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

fileId

Yes

String

Definition:

File ID.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Authorization

Yes

String

Definition:

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}.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

X-Traceid

No

String

Definition:

Service trace ID, which contains 58 bits.

Constraints:

N/A

Range:

The value contains 58 bits.

Default Value:

N/A

language

No

String

Definition:

Language code.

Constraints:

The value must comply with the internationalization specifications. For example, en_us indicates English (United States).

Range:

The value must comply with the internationalization specifications.

Default Value:

en-US

X-Date

Yes

String

Definition:

Date, which is used for app authentication. The format is yyyyMMdd'T'HHmmss'Z'.

Constraints:

The time must be within 15 minutes from the current time and cannot be later than the current time.

Range:

N/A

Default Value:

N/A

X-User-Id

Yes

String

Definition:

User ID on KooDrive, which is used for app authentication.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

X-Share-Shorturl

No

String

Definition:

Sharing short link.

Constraints:

This parameter is mandatory for previewing files shared by others.

Range:

N/A

Default Value:

N/A

Default Value:

N/A

X-Hw-Share-Folder-Id

No

String

Definition:

ID of a shared folder, which is returned by the API for creating a shared folder.

Constraints:

This parameter is mandatory for previewing files in a shared folder.

Range:

N/A

Default Value:

N/A

Default Value:

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

code

Integer

Response code.

msg

String

Response message.

link

String

File online preview link.

Example Requests

Obtains the online preview link of the Fk__xUmqLFEABKbZAiqlHvYUoxViDiWNA file.

GET /koodrive/ose/v1/files/preview/Fk__xUmqLFEABKbZAiqlHvYUoxViDiWNA/link

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

Example Responses

Status code: 200

Response to the request for obtaining the file online preview link.

{
  "link" : "https://xxxxxxx.obs.cn-north-4.myhuaweicloud.com/***********?response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27b112599cf0a74e7798fe9bd7e6725010.pdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20250924T093847Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Credential=*************SA%2F20250924%2Fnorth-4%2Fs3%2Faws4_request&X-Amz-Signature=*******",
  "code" : 0,
  "msg" : "Success."
}

Status Codes

Status Code

Description

200

Response to the request for obtaining the file online preview link.