调用ListInstances,获取实例列表。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求语法

GET /api/v1/instances?InstanceNameContains=String&InstanceStatusEquals=String&PageNumber=String&PageSize=String&SortOrder=String&SortBy=String HTTP/1.1
Content-Type:application/json

请求参数

表 1. 请求Query参数
参数名称 类型 是否必选 示例 说明
InstanceNameContains String test

实例名称关键字

InstanceStatusEquals String Runnning

实例状态

  • Running 运行中
  • Stopped 已停止
  • Starting 启动中
  • Stopping 停止中
  • Saving 保存镜像中
  • Failed 启动失败
PageNumber String 1

当前页

PageSize String 10

每页返回的实例数

SortOrder String Desc

排序顺序

  • Desc 逆序排列
  • Asc 升序排列
SortBy String gmtCreate

按返回字段排序

响应体语法

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "String",
  "Instances" : [ {
    "InstanceId" : "String",
    "InstanceName" : "String",
    "EcsSpec" : "String",
    "InstanceStatus" : "String",
    "JupyterlabUrl" : "String",
    "WebIdeUrl" : "String",
    "TerminalUrl" : "String",
    "AccumulativeRunningTimeInMinutes" : Long,
    "ImageId" : "String",
    "ImageUrl" : "String",
    "GmtCreateTime" : "String",
    "GmtModifiedTime" : "String",
    "UserId" : "String",
    "NasFileSystemId" : "String",
    "UserVpc" : {
      "VpcId" : "String",
      "VswitchId" : "String",
      "RoleArn" : "String",
      "SecurityGroupId" : "String"
    },
    "InstanceShutdownTimer" : {
      "InstanceId" : "String",
      "ScheduleTime" : "String",
      "GmtModifiedTime" : "String",
      "GmtCreateTime" : "String"
    }
  } ],
  "PageNumber" : Long,
  "PageSize" : Long,
  "TotalCount" : Long
}

响应参数

表 2. 响应Body参数
参数名称 类型 示例 说明
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

请求ID

Instances Array of Instance

实例列表

PageNumber Long 1

当前页

PageSize Long 10

每页返回的实例数

TotalCount Long 30

符合条件的实例数

获取实例列表

GET /api/v1/instances?InstanceNameContains=test&InstanceStatusEquals=Runnning&EcsSpecEquals=ecs.g6.8xlarge&GmtCreateTimeAfter=2021-04-02T00:00:00Z&GmtCreateTimeBefore=2021-04-01T00:00:00Z&PageNumber=1&PageSize=10&SortBy=gmtCreate&SortOrder=Desc HTTP/1.1
Host:pai-dsw.aliyuncs.com
Content-Type:application/json

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
<Instances>
    <InstanceId>dsw-d7adefa77718****</InstanceId>
    <InstanceName>test</InstanceName>
    <EcsSpec>ecs规格</EcsSpec>
    <InstanceStatus>Running</InstanceStatus>
    <JupyterlabUrl>https://dsw-gateway-cn-beijing.aliyun.com/dsw-****/lab/</JupyterlabUrl>
    <WebIdeUrl>https://dsw-gateway-cn-beijing.aliyun.com/dsw-****/ide/</WebIdeUrl>
    <TerminalUrl>https://dsw-gateway-cn-beijing.aliyun.com/dsw-****/terminals/tty</TerminalUrl>
    <AccumulativeRunningTimeInMinutes>10</AccumulativeRunningTimeInMinutes>
    <ImageId>img-d7adefa77718*****</ImageId>
    <ImageUrl>registry.cn-shanghai.aliyuncs.com/pai_product/image:pai-images-dsw-ubuntu18.04-py3.6-paitf1.15-build.****</ImageUrl>
    <GmtCreateTime>2021-04-01T00:00:00Z</GmtCreateTime>
    <GmtModifiedTime>2021-04-02T00:00:00Z</GmtModifiedTime>
    <UserId>161228528250****</UserId>
    <NasFileSystemId>0051a4****</NasFileSystemId>
    <UserVpc>
        <VpcId>vpc-bp1i4x5wj2kgro93l****</VpcId>
        <VswitchId>vsw-bp1irltu139f5qufw****</VswitchId>
        <RoleArn>acs:ram::123456789012****:role/appserverrole</RoleArn>
        <SecurityGroupId>sg-bp10mttdnsk58y5n****</SecurityGroupId>
    </UserVpc>
    <InstanceShutdownTimer>
        <InstanceId>dsw-d7adefa77718****</InstanceId>
        <ScheduleTime>2021-04-01T01:00:00Z</ScheduleTime>
        <GmtModifiedTime>2021-04-01T00:00:00Z</GmtModifiedTime>
        <GmtCreateTime>2021-04-01T00:00:00Z</GmtCreateTime>
    </InstanceShutdownTimer>
</Instances>
<PageNumber>1</PageNumber>
<PageSize>10</PageSize>
<TotalCount>30</TotalCount>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "Instances" : [ {
    "InstanceId" : "dsw-d7adefa77718****",
    "InstanceName" : "test",
    "EcsSpec" : "ecs规格",
    "InstanceStatus" : "Running",
    "JupyterlabUrl" : "https://dsw-gateway-cn-beijing.aliyun.com/dsw-****/lab/",
    "WebIdeUrl" : "https://dsw-gateway-cn-beijing.aliyun.com/dsw-****/ide/",
    "TerminalUrl" : "https://dsw-gateway-cn-beijing.aliyun.com/dsw-****/terminals/tty",
    "AccumulativeRunningTimeInMinutes" : 10,
    "ImageId" : "img-d7adefa77718*****",
    "ImageUrl" : "registry.cn-shanghai.aliyuncs.com/pai_product/image:pai-images-dsw-ubuntu18.04-py3.6-paitf1.15-build.****",
    "GmtCreateTime" : "2021-04-01T00:00:00Z",
    "GmtModifiedTime" : "2021-04-02T00:00:00Z",
    "UserId" : "161228528250****",
    "NasFileSystemId" : "0051a4****",
    "UserVpc" : {
      "VpcId" : "vpc-bp1i4x5wj2kgro93l****",
      "VswitchId" : "vsw-bp1irltu139f5qufw****",
      "RoleArn" : "acs:ram::123456789012****:role/appserverrole",
      "SecurityGroupId" : "sg-bp10mttdnsk58y5n****"
    },
    "InstanceShutdownTimer" : {
      "InstanceId" : "dsw-d7adefa77718****",
      "ScheduleTime" : "2021-04-01T01:00:00Z",
      "GmtModifiedTime" : "2021-04-01T00:00:00Z",
      "GmtCreateTime" : "2021-04-01T00:00:00Z"
    }
  } ],
  "PageNumber" : 1,
  "PageSize" : 10,
  "TotalCount" : 30
}

错误码

访问错误中心查看更多错误码。

开发者资源

  • SDK

    阿里云为您提供多种语言的SDK,帮助您快速通过API集成阿里云的产品和服务,推荐您使用SDK调用API,已免除您手动签名验证。

  • OpenAPI Explorer

    快速检索,可视化调试API,在线命令行工具,同步动态生成可执行的SDK代码示例。

  • 阿里云CLI

    阿里云资产管理和配置工具,可通过命令方式同时管理多个阿里云产品和服务,简单快捷,是您上云好帮手。