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

Querying Cloud Phones

Function Description

  • API name

    ListCloudPhones

  • Function

    This API is used to query cloud phones by page. The cloud phones are sorted in descending order by creation time. You can specify offset and limit. If no cloud phone exists, an empty list is returned.

URI

GET /v1/{project_id}/cloud-phone/phones?phone_name={phone_name}&server_id={server_id}&status={status}&offset={offset}&limit={limit}&type={type}

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.

phone_name

No

String

Specifies the cloud phone name. Fuzzy query is supported.

server_id

No

String

Specifies the cloud phone server ID.

status

No

Integer

Specifies the cloud phone status.

  • 1: Creating
  • 2: Running
  • 3: Resetting
  • 4: Restarting
  • 6: Frozen
  • 7: Stopping
  • 8: Stopped
  • -5: Reset failed
  • -6: Restart failed
  • -7: Abnormal
  • -8: Creation failed
  • -9: Stopping failed

offset

No

Integer

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

type

No

Integer

Specifies the cloud phone type.

  • 0: common cloud phone
  • 1: trial cloud phone

Request

  • Request parameters

    None

  • Example request
    1
    GET https://{CPH Endpoint}/v1/{project_id}/cloud-phone/phones?offset=0&limit=10
    

Response

  • Parameter description

    Parameter

    Type

    Description

    request_id

    String

    Specifies the request ID, which is unique.

    phones

    Array of objects

    Specifies the cloud phone information. For details, see Table 2.

    Table 2 Data structure description of phone

    Parameter

    Type

    Description

    phone_name

    String

    Specifies the cloud phone name, which can contain a maximum of 65 bytes.

    server_id

    String

    Specifies the cloud phone server ID, which can contain a maximum of 32 bytes.

    phone_id

    String

    Specifies the unique identifier of the cloud phone, which can contain a maximum of 32 bytes.

    phone_model_name

    String

    Specifies the cloud phone flavor, which can contain a maximum of 64 bytes.

    For details, see Cloud Phone Flavor List.

    image_id

    String

    Specifies the cloud phone image ID, which can contain a maximum of 32 bytes.

    vnc_enable

    String

    Specifies whether to enable VNC login on a cloud phone.

    • true: enable
    • false: disable

    metadata

    Object

    Specifies the order and product information. For details, see Table 3.

    status

    Integer

    Specifies the cloud phone status.

    • 0 and 1: Creating
    • 2: Running
    • 3: Resetting
    • 4: Restarting
    • 6: Frozen
    • 7: Stopping
    • 8: Stopped
    • -5: Reset failed
    • -6: Restart failed
    • -7: Abnormal
    • -8: Creation failed
    • -9: Stopping failed

    type

    Integer

    Specifies the cloud phone type.

    • 0: common cloud phone
    • 1: trial cloud phone

    create_time

    String

    Specifies when the cloud phone was created.

    The time format is UTC.

    update_time

    String

    Specifies when the cloud phone was updated.

    The time format is UTC.

    availability_zone

    String

    Specifies the AZ where the cloud phone is located.

    Table 3 Data structure description of metadata

    Parameter

    Type

    Description

    order_id

    String

    Specifies the order ID, which can contain a maximum of 64 bytes.

    product_id

    String

    Specifies the product ID, which can contain a maximum of 64 bytes.

  • Example response
    { 
        "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085", 
        "phones": [
            {
                "phone_name": "mobile-0001",
                "server_id": "88b8449b896f3a4f0ad57222dd91909",
                "phone_id": "1234567b8bab40ffb711234cb80d0234",
                "phone_model_name": "AOSP-1U4G15G-001",
                "image_id": "88b8449b896f3a4f0ad57222dd91909",
                "vnc_enable": "true",
                "status": 2,
                "type": 0,
                "metadata": {
                    "order_id": "CS1710111105S8IPB",
                    "product_id": "00301-25217-0--0"
                },
                "availability_zone": "br-iaas-odin1a",
                "create_time": "2017-10-10T00:00:00Z",
                "update_time": "2018-10-10T00:00:00Z"
            }
        ]
    }

Returned Values

See Returned Values.

Error Codes

See Error Codes.