
# 查询镜像支持的OS列表 - ListOsVersions
#### 功能介绍
查询当前区域弹性云服务器的OS兼容性列表。
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?locale=zh-cn&consoleCurrentProductId=ims&consoleCurrentProductshort=&product=IMS&api=ListOsVersions)中调试该接口。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-ims/ims_03_appendix_03.html)。
#### URI
GET /v1/cloudimages/os_version
表1查询参数 
| 参数  | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|:---|:---|:---|:---|
| tag | 否    | String | **参数解释：** OS的标签。根据标签值可以过滤查询指定特性的OS信息。 **约束限制：** 不带tag查询条件则默认查询当前region支持的所有的OS列表。 **取值范围：** - bms：表示该镜像支持BMS的os_version列表。  - uefi：支持UEFI启动方式的os_version列表。  - arm：显示基于arm架构的os_version列表。  - x86：显示基于x86架构的os_version列表。   **默认取值：** 不涉及 |
   
#### 请求消息
- 请求参数 无
  
 
#### 请求示例
- 查询当前region支持的OS列表
  ```
  GET https://{Endpoint}/v1/cloudimages/os_version
  ```
  
- 根据过滤条件查询OS列表
  ```
  GET https://{Endpoint}/v1/cloudimages/os_version?tag=uefi
  ```
  
 
#### 响应消息
- 响应参数
  
  | 参数         | 参数类型             | 描述                                                                                                                                                                                      |
  |:---|:---|:---|
  | *\[数组元素\]* | Array of objects | **参数解释：** 镜像支持的OS列表信息。详情请参见[表2 \[数组元素\]字段说明]。 **取值范围：** 不涉及 |
     
   表2*\[数组元素\]* 字段说明 
  | 参数           | 参数类型             | 描述                                                                                                                                                                                                          |
  |:---|:---|:---|
  | platform     | String           | **参数解释：** 操作系统平台。 **取值范围：** 不涉及                                                                                      |
  | version_list | Array of objects | **参数解释：** 返回的操作系统详情。具体请参见[表3 \[数组元素\].version_list字段数据结构说明]。 **取值范围：** 不涉及 |
     
   表3*\[数组元素\]* .version_list字段数据结构说明 
  | 参数             | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                    |
  |:---|:---|:---|
  | platform       | String  | **参数解释：** 操作系统平台。 **取值范围：** 不涉及                                                                                                                                                                                                                           |
  | os_version_key | String  | **参数解释：** 操作系统key值。其中os_version为操作系统完整信息。默认取os_version的值为key值。 **取值范围：** 不涉及                                                                                                                                                                             |
  | os_version     | String  | **参数解释：** 操作系统完整信息。 **取值范围：** 不涉及                                                                                                                                                                                                                             |
  | os_bit         | Integer | **参数解释：** 操作系统的位数。 **取值范围：** 取值为32或者64。 - 32：32位操作系统  - 64：64位操作系统   |
  | os_type        | String  | **参数解释：** 操作系统类型。 **取值范围：** - Linux：Linux操作系统  - Windows：Windows操作系统                              |
     
  
- 响应样例
  ```
  STATUS CODE 200
  ```
  ```
  [
      {
          "platform": "SUSE",
          "version_list": [
              {
                  "platform": "SUSE",
                  "os_version_key": "SUSE Linux Enterprise Server 15 64bit",
                  "os_version": "SUSE Linux Enterprise Server 15 64bit",
                  "os_bit": 64,
                  "os_type": "Linux"
              },
              {
                  "platform": "SUSE",
                  "os_version_key": "SUSE Linux Enterprise Server 12 SP3 64bit",
                  "os_version": "SUSE Linux Enterprise Server 12 SP3 64bit",
                  "os_bit": 64,
                  "os_type": "Linux"
              }
          ]
      },
      {
          "platform": "Other",
          "version_list": [
              {
                  "platform": "Other",
                  "os_version_key": "Other(32 bit)",
                  "os_version": "Other(32 bit)",
                  "os_bit": 32,
                  "os_type": "Linux"
              }
          ]
      }
  ]
  ```
  
#### 返回值
- 正常 200
  
- 异常
  
  | 返回值                       | 说明                                                                              |
  |:---|:---|
  | 400 Bad Request           | 请求错误，具体返回错误码请参见[错误码](https://support.huaweicloud.com/api-ims/ims_03_0908.html)。 |
  | 401 Unauthorized          | 鉴权失败。                                                                           |
  | 403 Forbidden             | 没有操作权限。                                                                         |
  | 404 Not Found             | 找不到资源。                                                                          |
  | 500 Internal Server Error | 服务内部错误。                                                                         |
  | 503 Service Unavailable   | 服务不可用。                                                                          |
     
  
 
