Updated on 2023-03-16 GMT+08:00

Querying Shared Storage Files

Function Description

  • API name

    ListShareFiles

  • Function

    This API is used to query files in a specified path of the shared storage. This function is supported only by cloud phones that support shared storage. You can use parameter extend_spec in Querying Cloud Phone Flavors to check whether shared storage is supported. (If extend_spec contains field max_share_disk_size_g, shared storage is supported.)

URI

GET /v1/{project_id}/cloud-phone/servers/share-files?path=/data/data&server_ids=xxxxxxx,xxxxxxx&limit=100&offset=0

For details, see Table 1.
Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

For details about how to obtain the project ID, see Obtaining a Project ID.

path

Yes

String

Specifies the name of the directory to be queried.

The name can contain letters, digits, periods (.), plus signs (+), hyphens (-), underscores (_), slashes (/), and equal signs (=). The name must start with a slash (/) and cannot contain only slashes (/). // or ../ is not allowed.

Example: /data/data

server_ids

Yes

String

Specifies the ID list of the cloud phone servers.

You can obtain server IDs by referring to Querying Cloud Phone Servers. Use commas (,) to separate multiple server IDs.

offset

No

Integer

Specifies the offset.

If the value is an integer greater than 0 but less than the number of resources, all resources after this offset will be queried. The default value is 0.

limit

No

Integer

Specifies the number of resources returned on each page.

Value range: 1–100 (default value: 50)

Generally, set this parameter to 10, 20, or 50.

Request

  • Request parameters

    None

  • Example request
    GET https://{CPH Endpoint}/v1/{project_id}/cloud-phone/servers/share-files?path=/data/data&server_ids=203a7243181646b190047ade6bfd882d

Response

  • Response parameters

    Parameter

    Type

    Description

    request_id

    String

    Specifies the request ID, which is unique.

    jobs

    Array of objects

    Specifies the task information. For details, see Table 2.

    Table 2 Data structure description of job

    Parameter

    Type

    Description

    server_id

    String

    Specifies the unique identifier of the cloud phone server.

    job_id

    String

    Specifies the unique ID of a task.

  • Example response
    {
        "request_id": "6837531fd3f54550927b930180a706bf",
        "jobs": [
            {
                "server_id": "203a7243181646b190047ade6bfd882d",
                "job_id": "1564567b8bab40f34711234cb80d0123"
            }
        ]
    }

Task Result Description

The query result is returned through the execute_msg field of the task. For details about the task query result, see Querying the Task Execution Status.

Table 3 execute_msg description

Parameter

Type

Description

files_in_path

files_in_path

Specifies the files in a specified directory. The format is as follows:

[File size Time File name]

share_base_capacity

String

Specifies the overall capacity information about the shared storage. The four fields are as follows:

Size Used Avail Use%

share_base_max_size

String

Specifies the total size of shared storage.

Table 4 files_in_path description

Parameter

Type

Description

total

Integer

Specifies the total number of files in a specified directory.

count

Integer

Specifies the number of files in the specified directory returned in this query.

files

Array of strings

Specifies the files in a specified directory. The format is as follows:

[File size Time File name]

Example result:

{
    "error_msg": null,
    "execute_msg": "{\"files_in_path\":{\"total\":1,\"count\":1,\"files\":[\"4096 Apr 15 09:49 com.tencent.mm\"]},\"share_base_max_size\":\"50G\",\"share_base_capacity\":\"8.9G 323M 8.2G 4%\"}",
    "job_id": "1564567b8bab40f34711234cb80d0123",
    "end_time": "2020-07-28T07:32:14Z",
    "begin_time": "2020-07-28T07:31:50Z",
    "error_code": null,
    "request_id": "af28fb2c79f84b74821e99a4b3aace53",
    "status": 2
}

Returned Values

See Returned Values.

Error Codes

See Error Codes.