全部产品
Search
文档中心

对象存储 OSS:DescribeRegions

更新时间:Aug 18, 2023

调用DescribeRegions接口查询所有支持地域或者指定地域对应的Endpoint信息,包括外网Endpoint、内网Endpoint和传输加速Endpoint。

注意事项

  • 要查询地域对应的Endpoint信息,您必须有oss:DescribeRegions权限。具体操作,请参见为RAM用户授权自定义的权限策略

  • 只支持在二级域名(例如oss-cn-hangzhou.aliyuncs.com)上调用DescribeRegions接口。

请求语法

说明

目前支持查询的地域请参见OSS Region和Endpoint对照表(公共云)

  • 查询所有支持地域对应的Endpoint信息

    GET /?regions HTTP/1.1
    Host: oss.example.com
    Date: GMT Date
    Authorization: SignatureValue
  • 查询指定地域对应的Endpoint信息

    GET /?regions=oss-cn-hangzhou HTTP/1.1
    Host: oss.example.com
    Date: GMT Date
    Authorization: SignatureValue

请求头

此接口仅涉及公共请求头。更多信息,请参见公共请求头(Common Request Headers)

响应头

此接口仅涉及公共响应头。更多信息,请参见公共响应头(Common Response Headers)

响应元素

名称

类型

示例值

描述

RegionInfoList

容器

不涉及

地域信息列表。

子节点:RegionInfo

父节点:无

RegionInfo

容器

不涉及

地域信息。

子节点:Region、InternetEndpoint、InternalEndpoint、AccelerateEndpoint

父节点:RegionInfoList

Region

字符串

oss-cn-hangzhou

地域ID。

父节点:RegionInfo

InternetEndpoint

字符串

oss-cn-hangzhou.aliyuncs.com

地域对应的外网Endpoint。

父节点:RegionInfo

InternalEndpoint

字符串

oss-cn-hangzhou-internal.aliyuncs.com

地域对应的内网Endpoint。

父节点:RegionInfo

AccelerateEndpoint

字符串

oss-accelerate.aliyuncs.com

地域对应的传输加速Endpoint。取值固定为oss-accelerate.aliyuncs.com。

父节点:RegionInfo

示例

  • 查询所有支持地域的描述信息

    • 请求示例

      GET /?regions HTTP/1.1
      Host: oss-cn-hangzhou.aliyuncs.com
      Date: Fri, 20 Aug 2021 06:38:30 GMT
      Authorization: SignatureValue
    • 返回示例

      HTTP/1.1 200 OK
      x-oss-request-id: 3a8f-2e2d-7965-3ff9-51c875b*****
      Date: Fri, 20 Aug 2021 06:38:30 GMT
      Content-Type: application/xml
      Content-Length: 344606
      Server: AliyunOSS
      
      <?xml version="1.0" encoding="UTF-8"?>
      <RegionInfoList>
        <RegionInfo>
           <Region>oss-cn-hangzhou</Region>
           <InternetEndpoint>oss-cn-hangzhou.aliyuncs.com</InternetEndpoint>
           <InternalEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</InternalEndpoint>
           <AccelerateEndpoint>oss-accelerate.aliyuncs.com</AccelerateEndpoint>  
        </RegionInfo>
        <RegionInfo>
           <Region>oss-cn-shanghai</Region>
           <InternetEndpoint>oss-cn-shanghai.aliyuncs.com</InternetEndpoint>
           <InternalEndpoint>oss-cn-shanghai-internal.aliyuncs.com</InternalEndpoint>
           <AccelerateEndpoint>oss-accelerate.aliyuncs.com</AccelerateEndpoint>  
        </RegionInfo>
      </RegionInfoList>
  • 查询指定地域的描述信息

    • 请求示例

      GET /?regions=oss-cn-hangzhou HTTP/1.1
      Host: oss-cn-hangzhou.aliyuncs.com
      Date: Fri, 20 Aug 2021 06:40:30 GMT
      Authorization: SignatureValue
    • 返回示例

      HTTP/1.1 200 OK
      x-oss-request-id: 3a8f-2e2d-7965-3ff9-51c875b*****
      Date: Fri, 20 Aug 2021 06:40:30 GMT
      Content-Type: application/xml
      Content-Length: 3446
      Server: AliyunOSS
      
      <?xml version="1.0" encoding="UTF-8"?>
      <RegionInfoList>
        <RegionInfo>
          <Region>oss-cn-hangzhou</Region>
          <InternetEndpoint>oss-cn-hangzhou.aliyuncs.com</InternetEndpoint>
          <InternalEndpoint>oss-cn-hangzhou-internal.aliyuncs.com</InternalEndpoint>
          <AccelerateEndpoint>oss-accelerate.aliyuncs.com</AccelerateEndpoint>  
        </RegionInfo>
      </RegionInfoList>

错误码

错误码

HTTP状态码

描述

AccessDenied

403

返回该错误的可能原因如下:

  • 发起DescribeRegions请求时没有传入用户验证信息或者用户验证信息错误。

  • 用户无oss:DescribeRegions权限。

    请通过脚本配置方式创建自定义权限策略,然后为指定的RAM用户授予相应权限。具体操作,请参见为RAM用户授权自定义的权限策略

InvalidArgument

400

参数不合法。

NoSuchRegion

404

地域不存在。