All Products
Search
Document Center

Drive and Photo Service:Evoke a desktop client

Last Updated:Jan 07, 2025

Note

This topic describes how to use a URL scheme to evoke a desktop client and perform specific operations.

1 URL scheme

The name of the protocol for the URL scheme of the BasicUI desktop client is pds followed by the ID of the domain.

For example, if the ID of the domain is hz65, the name of the protocol for the URL scheme is pdshz65:.

Example of opening a URL:

window.open("pdshz65:open?opt=%7B%22seq_id%22%3A%22x3hug4qu1xn%22%2C%22pathname%22%3A%22%2Findex%22%7D")

2 URL parameters

<protocol>:<action>?opt=[opt]

Parameter

Description

protocol

The name of the protocol. The value is pds followed by the ID of the domain.

action

The pathname of the URL. The value is a verb. Valid values: open and download.

opt

The string that is generated after the specified JSON string is encoded by using the encodeURIComponent(JSON.stringify(opt)) function.

2.1 Open a specific URL

Fields of the opt parameter:

Field

Description

seq_id

The sequence ID. The ID must be unique in a session. A session lasts from the opening to the closing of a desktop client.

pathname

The pathname of the URL to which you are redirected after the client is woken up.

Example:

let domainId='hz65'
let action='open'
let opt ={
  "seq_id": Math.random().toString(36).substring(2),
  "pathname":"/drive"
}
let url = `pds${domainId}:${action}?opt=${encodeURIComponent(JSON.stringify(opt))}`
window.open(url)

2.2 Download a specific file

Fields of the opt parameter:

Field

Description

seq_id

The sequence ID. The ID must be unique in a session. A session lasts from the opening to the closing of a desktop client.

pathname

The pathname of the URL to which you are redirected after the client is woken up.

loc_type

The type of the storage location. Valid values: drive and share.

loc_id

The ID of the storage location. If the loc_type field is set to drive, the value of this field is drive_id. If the loc_type field is set to share, the value of this field is share_id.

file_keys

The file to be downloaded. If the storage is in standard mode, the value is an array of file_id. If the storage is in hosting mode, the value is an array of file_path. Example: ["file_id1","file_id2"].

Example:

let domainId='hz65'
let action='download'
let opt ={
  "seq_id": Math.random().toString(36).substring(2),
  "loc_type": "drive",
  "loc_id": "1",
  "pathname":"/drive/folders/5e9d2e02570e5a973cd64b648cbf97ac2ebb26dc",
  "file_keys":["5faebd028e8365fef08b4a019308765631e179e0"]
}
let url = `pds${domainId}:${action}?opt=${encodeURIComponent(JSON.stringify(opt))}`
window.open(url)