Updated on 2024-08-09 GMT+08:00

Exporting Data from Cloud Phones

Function

This asynchronous API is used to export data from cloud phones in batches. Before calling this API, ensure that the CPH service has been authorized to operate OBS buckets. For details, see Delegating CPH to Operate OBS Buckets.

URI

POST /v1/{project_id}/cloud-phone/phones/batch-storage

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. It can be obtained by calling an Identity and Access Management (IAM) API. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

storage_infos

Yes

Array of StorageInfo objects

Specifies the information about the cloud phone whose data will be exported.

Table 4 StorageInfo

Parameter

Mandatory

Type

Description

phone_id

Yes

String

Specifies the cloud phone ID.

include_files

Yes

Array of strings

Path for storing the data to be exported. The value is an absolute path and contains a maximum of 4096 bytes. Only data in the /data and cache directories can be exported. Currently, only uppercase letters, lowercase letters, digits, dots (.), slashes (/), hyphens (-), underscores (_), plus signs (+), number signs (#), asterisks (*), and equal signs (=) are supported.

exclude_files

No

Array of strings

Specifies the path from which data cannot be exported. exclude_files has a higher priority than include_files. If the two parameters conflict with each other, exclude_files takes effect. The path requirements are the same as those for include_files.

bucket_name

Yes

String

Specifies the name of the OBS bucket for storing the exported data. A valid OBS bucket name contains 3 to 63 characters, including only lowercase letters, digits, hyphens (-), and periods (.).

object_path

Yes

String

Specifies the OBS path for storing the exported data. The value must comply with the OBS path naming specifications and can contain a maximum of 1024 characters. Currently, only uppercase letters, lowercase letters, digits, dots (.), slashes (/), hyphens (-), underscores (_), plus signs (+), number signs (#), and equal signs (=) are supported.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the unique request ID.

jobs

Array of PhoneJob objects

Task information

Table 6 PhoneJob

Parameter

Type

Description

phone_id

String

Specifies the unique ID of a cloud phone. This parameter is contained in tasks related to cloud phones.

job_id

String

Specifies the unique ID of a task.

error_code

String

Specifies the error code.

error_msg

String

Specifies the error message.

Example Requests

Exporting data of cloud phones to an OBS bucket

POST https://{CPH Endpoint}/v1/{project_id}/cloud-phone/phones/batch-storage

{
  "storage_infos" : [ {
    "phone_id" : "1234567b8bab40ffb711234cb80d0234",
    "include_files" : [ "/data/app", "/data/local", "/data/media" ],
    "exclude_files" : [ "/data/app/com.xx.xx-*" ],
    "bucket_name" : "mybucket",
    "object_path" : "myimage/v1/xxxxx.tar"
  } ]
}

Example Responses

Status code: 200

OK

{
  "request_id" : "6837531fd3f54550927b930180a706bf",
  "jobs" : [ {
    "phone_id" : "1234567b8bab40ffb711234cb80d0234",
    "job_id" : "1564567b8bab40f34711234cb80d0123"
  } ]
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.