Changing a Key Pair

Function Description

  • API Name

    UpdateKeypair

  • Function

    Change the key pair for connecting to the cloud phone.

URI

PUT /v1/{project_id}/cloud-phone/servers/open-access

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.

Request

  • Request parameters

    Parameter

    Mandatory

    Type

    Description

    servers

    Yes

    Array of objects

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

    Table 2 servers field description

    Parameter

    Mandatory

    Type

    Description

    server_id

    Yes

    String

    Specifies the cloud phone server ID. The value can contain a maximum of 32 bytes.

    You can obtain the value of this parameter from the server_id field in the response in Querying the Cloud Phone Servers.

    keypair_name

    Yes

    String

    Specifies the key pair name.

    • If you want to use an existing key pair of the current account, you can query the SSH key list to view all key pairs of the account and obtain the value of keypair_name.
    • If you want to use a new key pair, log in to the management console and create a key pair. For details, see Creating a Key Pair.
  • Example request
    PUT https://{CPH Endpoint}/v1/{project_id}/cloud-phone/servers/open-access
    {
        "servers": [
            {
                "keypair_name": "mykeypair",
                "server_id": "ae4d231e44d2a4ccf612660a473fe1e3"
            },
            {
                "keypair_name": "mykeypair",
                "server_id": "2347275010d3440d963d3fcb8931ff55"
            }
        ]
    }

Response

  • Response parameters

    Parameter

    Type

    Description

    request_id

    String

    Specifies the request ID, which is unique.

    jobs

    Array of objects

    Specifies the task information. For details, see Table 3.

    Table 3 job field description

    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.

  • Example response
    { 
        "request_id": "6837531fd3f54550927b930180a706bf",
        "jobs": [
            {
                "server_id": "ae4d231e44d2a4ccf612660a473fe1e3",
                "job_id": "1564567b8bab40f34711234cb80d0123"
            },
            {
                "server_id": "2347275010d3440d963d3fcb8931ff55",
                "job_id": "1564567b8bab40f34711234cb80d5678"
            }
        ]
    }

Returned Values

See Returned Values.

Error Codes

See Error Codes.