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

Restoring Data of Cloud Phones

Function

This asynchronous API is used to restore data to 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.

Data exported from a cloud phone running a later Android version cannot be restored on a cloud phone running an earlier Android version. Data exported from a cloud phone of an earlier Android version can be restored on a cloud phone of a later Android version. However, there may be compatibility issues in a few scenarios. It is recommended that you export and restore data between cloud phones of the same Android version.

When a cloud phone is in use, it stores data in its cache. If you try to run restored files without restarting the cloud phone, you may experience access issues or application crashes. To avoid this and ensure stable performance, restart the cloud phone after successful restoration.

URI

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

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

restore_infos

Yes

Array of RestoreInfo objects

Specifies the information about the cloud phone to which data will be imported.

Table 4 RestoreInfo

Parameter

Mandatory

Type

Description

phone_id

Yes

String

Specifies the cloud phone ID.

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.

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

Restoring data from an OBS bucket to a cloud phone

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

{
  "restore_infos" : [ {
    "phone_id" : "1234567b8bab40ffb711234cb80d0234",
    "bucket_name" : "mybucket",
    "object_path" : "myimage/v1/xxxx.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.