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

Pushing a Shared Application

Function Description

  • API name

    PushShareApps

  • Function

    This API is used to push tar. files of applications to a shared storage directory. This function is available only on cloud phones that support shared applications. You can view parameter extend_spec in Querying Cloud Phone Flavors to check whether the cloud phone flavor supports shared applications.

    This function is available only on cloud phones that support shared applications. To use this function, submit a service ticket to make cloud phones of such specifications be available for you.

URI

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

Table 1 lists the URI parameter.

Table 1 URI parameter

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.

Request

  • Request parameters

    Parameter

    Mandatory

    Type

    Description

    package_name

    Yes

    String

    Specifies the valid name of the application package.

    pre_install_app

    No

    Integer

    Specifies whether to preinstall applications.

    1: Preinstall applications.

    0: (Default) Applications do not need to be preinstalled.

    bucket_name

    Yes

    String

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

    object_path

    Yes

    String

    A valid OBS object path can contain a maximum of 1,024 characters, including only letters, digits, periods (.), 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 IDs of the cloud phone servers.

    Obtain them by referring to Querying Cloud Phone Servers.

  • Example request
    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" 
         ] 
     }

Response

  • Response parameters

    Parameter

    Type

    Description

    request_id

    String

    Specifies the unique request ID.

    jobs

    Array of objects

    Specifies the job 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 job.

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

Returned Values

See Returned Values.

Error Codes

See Error Codes.