Querying Shared Storage Files

Function Description

  • API Name

    ListShareFiles

  • Function

    Query the files in the specified path of the shared storage. This function is supported only by cloud phones that support shared storage. You can use the extend_spec parameter in Querying the Cloud Phone Flavors to check whether shared storage is supported. (If the extend_spec parameter contains the max_share_disk_size_g field, 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 value can contain uppercase letters, lowercase letters, digits, periods (.), plus signs (+), hyphens (-), underscores (_), and slashes (/). The value 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 the value of this parameter by referring to Querying the Cloud Phone Servers. Use commas (,) to separate multiple server IDs.

offset

No

Integer

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: 100)

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 job field description

    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

String

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%

Example result:

{
    "error_msg": null,
    "execute_msg": "{\"files_in_path\":[\"4096\\t Jul\\t 28\\t 15:28\\t com.dygame.hyrj.dayu\\t \"],\"share_base_capacity\":\"33G\\t 186M\\t 31G\\t 1%\\t \"}",
    "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.