1. 云服务器列表

1.1. 描述

获取可用云服务器列表

1.2. 请求地址

请求地址的格式如下:

https://<区域服务地址>/v1/vm/list

1.3. 请求参数

Name Type Description Required
projectId String 主机所属项目ID
azSn String azSn
nameOrSn String 主机名称或SN
status String 状态,可选项:(运行:ACTIVE,关闭:SHUTOFF,资源隔离:ISOLATED)
os String 操作系统,可选项:(OS-TYPE-CENTOS,OS-TYPE-DEBIAN,OS-TYPE-FG,OS-TYPE-REDHAT,OS-TYPE-SUSE,OS-TYPE-UBUNTU,OS-TYPE-WIN)
vpc String 主机关联的vpcId
subnet String 主机关联的subnetId
eip String 主机绑定的公网IP地址
curPage Integer 当前页码,默认值1
perPage Integer 每页显示条数,默认值10

1.4. 请求示例

1.4.1. 请求地址

POST https://cn-east-1.api.yovole.com/v1/vm/list HTTP/1.1
  x-ycs-timestamp: 2019-06-19T14:26:26Z
  x-ycs-requestid: 2a49cfa2-925b-11e9-bb3a-6c96cfdcd6b9
  x-ycs-security-authorization: Authorization: YCS1-HMAC-SHA1 Credential=08e206fb-7b41-45b7-8076-8d43e8aeea89,SignedHeaders=content-type;x-ycs-requestid;x-ycs-timestamp,Signature=2RFjU7C9gICCrQfpAIfAJHqRRlQ=

1.4.2. 接口请求参数

{
  "projectId": "8a83a0966a681da5016a874df50b10ce",
  "azSN": "CN-EAST-1-A",  
  "curPage":1,
  "perPage":10
}

1.5. 返回结果

1.5.1. 返回正确结果示例

{
    "requestId":"c1d4a3f0-d508-4e0a-a447-f203f432b043",
    "success":true,
    "code":200,
    "pager":{
        "curPage":1,
        "perPage":10,
        "totalRecords":6,
        "totalPages":1,
        "pageData":[
            {
                "id":"f75d31d7-f624-44ab-b334-814f23a624d4",
                "name":"API按需创建主机 SSHKEY",
                "sn":"VM-21A-8KP60",
                "regionSn":"CN-EAST-1",
                "azSn":"CN-EAST-1-A",
                "created":"2019-05-20 17:14:48",
                "billingType":"POST_PAID",
                "vmProductName":"通用 I型",
                "attachVolumeCount":1,
                "azName":"可用区A",
                "status":"SHUTOFF",
                "osTypeName":"CentOS",
                "sysDiskSize":20,
                "portInfos":[
                    {
                        "subnetId":"98e6bf98-3283-4bed-80c8-2132a510aebb",
                        "subnetName":"API Create subnet",
                        "subnetSn":"SN-21A-8KP4V",
                        "subnetIp":"172.20.4.14",
                        "subnetCidr":"172.20.4.0/22"
                    }
                ],
                "flavorId":"ecs.c1.small",
                "flavorName":"ecs.c1.small",
                "cpu":1,
                "ram":1,
                "gpu":0
            },
            {
                "id":"5755c140-7748-4a0b-be9a-8915efdfad5a",
                "name":"API包年包月创建主机",
                "sn":"VM-21A-8KP5W",
                "regionSn":"CN-EAST-1",
                "azSn":"CN-EAST-1-A",
                "created":"2019-05-17 17:13:12",
                "billingType":"PRE_PAID",
                "vmProductName":"通用 I型",
                "expired":"2019-07-17 17:13:05",
                "attachVolumeCount":0,
                "azName":"可用区A",
                "status":"SHUTOFF",
                "osTypeName":"CentOS",
                "sysDiskSize":20,
                "portInfos":[
                    {
                        "subnetId":"98e6bf98-3283-4bed-80c8-2132a510aebb",
                        "subnetName":"API Create subnet",
                        "subnetSn":"SN-21A-8KP4V",
                        "subnetIp":"172.20.4.4",
                        "subnetCidr":"172.20.4.0/22"
                    }
                ],
                "flavorId":"ecs.c1.small",
                "flavorName":"ecs.c1.small",
                "cpu":1,
                "ram":1,
                "gpu":0
            },
            {
                "id":"43f4f701-f7ad-4d44-9aa7-c448d147a2c5",
                "name":"API按需创建主机",
                "sn":"VM-21A-8KP5V",
                "regionSn":"CN-EAST-1",
                "azSn":"CN-EAST-1-A",
                "created":"2019-05-17 16:22:45",
                "billingType":"POST_PAID",
                "vmProductName":"通用 I型",
                "attachVolumeCount":0,
                "azName":"可用区A",
                "status":"ACTIVE",
                "osTypeName":"CentOS",
                "sysDiskSize":20,
                "portInfos":[
                    {
                        "subnetId":"98e6bf98-3283-4bed-80c8-2132a510aebb",
                        "subnetName":"API Create subnet",
                        "subnetSn":"SN-21A-8KP4V",
                        "subnetIp":"172.20.4.6",
                        "subnetCidr":"172.20.4.0/22"
                    }
                ],
                "flavorId":"ecs.c1.small",
                "flavorName":"ecs.c1.small",
                "cpu":1,
                "ram":1,
                "gpu":0
            },
            {
                "id":"470258c4-d00c-467a-bff7-74c38b24fb76",
                "name":"API TEST",
                "sn":"VM-21A-8KP5U",
                "regionSn":"CN-EAST-1",
                "azSn":"CN-EAST-1-A",
                "created":"2019-05-15 16:12:55",
                "billingType":"PRE_PAID",
                "vmProductName":"通用 I型",
                "expired":"2019-07-15 16:12:49",
                "attachVolumeCount":0,
                "azName":"可用区A",
                "status":"ACTIVE",
                "osTypeName":"CentOS",
                "sysDiskSize":20,
                "portInfos":[
                    {
                        "subnetId":"98e6bf98-3283-4bed-80c8-2132a510aebb",
                        "subnetName":"API Create subnet",
                        "subnetSn":"SN-21A-8KP4V",
                        "subnetIp":"172.20.4.12",
                        "subnetCidr":"172.20.4.0/22"
                    }
                ],
                "flavorId":"ecs.c1.small",
                "flavorName":"ecs.c1.small",
                "cpu":1,
                "ram":1,
                "gpu":0
            },
            {
                "id":"f6509405-b150-44e6-b903-a7f6cf9bc8c4",
                "name":"API TEST",
                "sn":"VM-21A-8KP5T",
                "regionSn":"CN-EAST-1",
                "azSn":"CN-EAST-1-A",
                "created":"2019-05-15 15:11:07",
                "billingType":"POST_PAID",
                "vmProductName":"通用 I型",
                "attachVolumeCount":0,
                "azName":"可用区A",
                "status":"ACTIVE",
                "osTypeName":"CentOS",
                "sysDiskSize":20,
                "portInfos":[
                    {
                        "subnetId":"98e6bf98-3283-4bed-80c8-2132a510aebb",
                        "subnetName":"API Create subnet",
                        "subnetSn":"SN-21A-8KP4V",
                        "subnetIp":"172.20.4.8",
                        "subnetCidr":"172.20.4.0/22"
                    }
                ],
                "flavorId":"ecs.c1.small",
                "flavorName":"ecs.c1.small",
                "cpu":1,
                "ram":1,
                "gpu":0
            },
            {
                "id":"cccb6374-6094-41da-a6b4-00b9b2152942",
                "name":"WEB_TEST",
                "sn":"VM-21A-8KP5R",
                "regionSn":"CN-EAST-1",
                "azSn":"CN-EAST-1-A",
                "created":"2019-05-15 14:19:54",
                "billingType":"POST_PAID",
                "vmProductName":"通用 I型",
                "attachVolumeCount":0,
                "azName":"可用区A",
                "status":"ACTIVE",
                "osTypeName":"CentOS",
                "sysDiskSize":20,
                "portInfos":[
                    {
                        "subnetId":"e9389c4b-27c1-44d0-9b9a-3f1d0aa71978",
                        "subnetName":"默认子网",
                        "subnetSn":"SN-21A-8KP4U",
                        "subnetIp":"10.1.1.11",
                        "subnetCidr":"10.1.1.0/24"
                    }
                ],
                "flavorId":"ecs.c1.small",
                "flavorName":"ecs.c1.small",
                "cpu":1,
                "ram":1,
                "gpu":0
            }
        ]
    }
}

1.5.2. 返回错误结果示例

{
  "requestId": "2a49cfa2-925b-11e9-bb3a-6c96cfdcd6b9",
  "success": false,
  "code": 400,
  "message": "Required attribute 'projectId' not specified",
  "errorCode": "Invalid argument"
}

1.6. 错误码

可以通过错误返回结果中的code、errorCode和message字段了解错误分类和具体的错误原因。

该接口没有特殊错误码,错误码信息和简单的错误分析方法可以参考公共错误码

results matching ""

    No results matching ""