DescribeInstances
1. 接口描述
本接口(DescribeInstances)用于查询一台或多台虚拟机实例的信息。用户可以根据实例ID、实例名称等条件来查询实例的详细信息。
2. 请求参数
以下请求参数列表仅列出了接口中需要的请求参数
参数名称
必选
类型
描述
instanceIds
否
Array of String
根据实例ID列表进行筛选。
最大不能超过100个。
zoneId
否
String
实例所属的可用区ID。
imageId
否
String
镜像ID。
ipv4Address
否
String
根据实例关联的IPv4过滤。
ipv6Address
否
String
根据实例关联的IPv6信息过滤。
name
否
String
根据实例显示名称过滤。
该字段支持模糊搜索。
pageSize
否
Integer
返回的分页大小。
默认值:20。
pageNum
否
Integer
返回的分页数。
resourceGroupId
否
String
根据资源组ID过滤。
tagKeys
否
Array of String
根据标签键进行搜索。
最长不得超过20个标签键。
3. 响应结果
参数名称
类型
描述
requestId
String
唯一请求 ID。
每次请求都会返回。定位问题时需要提供该次请求的 requestId。
totalCount
Integer
符合条件的数据总数。
4. 代码示例
1. 查询虚拟机实例列表
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeInstances
<Common Request Params>
Request:
{
  "instanceIds": ["xxx"],
  "pageSize": 10,
  "pageNum": 1
}
Response:
{
  "requestId": "TFA4FD1A1-41B6-4BA7-A408-1D654A3E0D36",
  "response": {
      "requestId": "TFA4FD1A1-41B6-4BA7-A408-1D654A3E0D36",
      "totalCount": 1,
      "dataSet": [
          {
              "subnetId": "<subnetId>",
              "memory": 2,
              "instanceName": "instance",
              "enableIpForward": true,
              "keyId": "key-7K9AcYWv",
              "securityGroupId": "<securityGroupId>",
              "instanceId": "<instanceId>",
              "nics": [
                  {
                      "subnetId": "<subnetId>",
                      "resourceGroup": {
                          "resourceGroupName": "Default Resource Group",
                          "resourceGroupId": "<resourceGroupId>"
                      },
                      "primaryIpv4": "10.130.0.2",
                      "privateIpList": ["10.130.0.2"],
                      "nicSubnetType": "IPv4",
                      "updateTime": "2025-07-16T01:26:39Z",
                      "primaryIpv6": null,
                      "publicIpList": [],
                      "securityGroupId": "<securityGroupId>",
                      "ipv6Cidr": null,
                      "macAddress": "52:54:00:2f:a7:ec",
                      "instanceId": "<instanceId>",
                      "regionId": "asia-east-1",
                      "createTime": "2025-07-16T01:26:39Z",
                      "nicType": "Primary",
                      "vpcId": "<vpcId>",
                      "name": "Primary-Nic-asia-east-1-01",
                      "nicId": "<nicId>",
                      "status": "USED",
                      "secondaryIpv4s": [],
                      "tags":null
                  }
              ],
              "zoneId": "asia-east-1a",
              "resourceGroupId": "<resourceGroupId>",
              "nicNetworkType": "VirtioOnly",
              "privateIpAddresses": ["10.130.0.2"],
              "imageId": "<imageId>",
              "imageName": "<imageName>",
              "resourceGroupName": "Default Resource Group",
              "systemDisk": {
                  "diskSize": 20,
                  "diskId": "<diskId>",
                  "diskCategory": "<diskCategory>"
              },
              "instanceType": "z2a.cpu.1",
              "cpu": 1,
              "timeZone": "Asia/Shanghai",
              "enableAgent": true,
              "expiredTime": null,
              "publicIpAddresses": ["128.0.0.2"],
              "createTime": "2025-05-01T01:01:01Z",
              "dataDisks": null,
              "enableAgentMonitor": true,
              "status": "RUNNING",
              "tags":null
          }
      ]
  }
}5. 开发者工具
Zenlayer Cloud API 2.0 提供了配套的开发工具集(SDK),未来会陆续支持更多开发语言,方便快速接入和使用Zenlayer的产品和服务。
6. 错误码
下面包含业务逻辑中遇到的错误码,其他错误码见公共错误码
HTTP状态码
错误码
说明
最后更新于