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

Pushing Shared Applications

Function

This API is used to push .tar files of applications to the shared storage space. This function is available only on cloud phone servers that support application sharing. 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.

Note: Do not push application packages exported from a cloud phone of a later version to the cloud phone server of an earlier version. Or, there may be compatibility issues. If you use a cloud phone server of the physical.kg1.4xlarge.a.cp specifications, ensure that the available shared storage space is greater than twice the size of the TAR package.

URI

POST /v1/{project_id}/cloud-phone/phones/share-apps

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

package_name

Yes

String

Specifies the valid name of an application package.

pre_install_app

No

Integer

Indicates whether an application is pre-installed.

  • 1: pre-installed

  • 0: no (default)

bucket_name

Yes

String

Specifies the valid name of an OBS bucket, which can contain 3 to 63 characters, including only lowercase letters, digits, hyphens (-), and periods (.).

object_path

Yes

String

A valid OBS object key can contain a maximum of 1024 characters. The value can contain only uppercase letters, lowercase letters, digits, dots (.), slashes (/), hyphens (-), underscores (_), plus signs (+), number signs (#), and equal signs (=). Only .tar files can be pushed. The file is pushed to the cloud phone based on the directory structure of the decompressed .tar file.

server_ids

Yes

Array of strings

Specifies the ID list of cloud phone servers.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the unique request ID.

jobs

Array of ServerJob objects

Specifies the task list.

Table 5 ServerJob

Parameter

Type

Description

server_id

String

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

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

Pushing applications from the same OBS bucket to all servers in the server list

POST https://{CPH Endpoint}/v1/{project_id}/cloud-phone/phones/share-apps

{
  "package_name" : "com.miniteck.miniworld",
  "bucket_name" : "bucket",
  "object_path" : "my_apps/test.tar",
  "server_ids" : [ "1234567b8bab40ffb711234cb80d0234", "1678567b8bab40f93711234cb80d0764" ]
}

Example Responses

Status code: 200

OK

{
  "request_id" : "6837531fd3f54550927b930180a706bf",
  "jobs" : [ {
    "server_id" : "1234567b8bab40ffb711234cb80d0234",
    "job_id" : "1564567b8bab40f34711234cb80d0123"
  }, {
    "server_id" : "1678567b8bab40f93711234cb80d0764",
    "job_id" : "1564567b8bab40f34711234cb80d5678"
  } ]
}

Status Codes

Status Code

Description

200

OK

Error Codes

See Error Codes.