
# 查询项目配额 - ShowProjectQuota
#### 功能介绍
该接口可以用于查询项目配额。
该接口可以使用全局区域的Endpoint和其他区域的Endpoint调用。IAM的Endpoint请参见：[地区和终端节点](https://developer.huaweicloud.com/endpoint?IAM)。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/IAM/doc?api=ShowProjectQuota)中调试该接口。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-iam/iam_19_0001.html)。
#### URI
GET /v3.0/OS-QUOTA/projects/{project_id}
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                         |
|:---|:---|:---|:---|
| project_id | 是    | String | 待查询的项目ID，获取方式请参见：[获取账号、IAM用户、项目、用户组、区域、委托的名称和ID](https://support.huaweicloud.com/api-iam/iam_17_0002.html) |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                 |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 拥有Security Administrator权限的token。或IAM用户的token。（无需特殊权限，但token的scope需为URL中的project。） |
   
#### 响应参数
表3响应Body参数 
| 参数                                           | 参数类型   | 描述      |
|:---|:---|:---|
| [quotas] | object | 账号配额信息。 |
   
 表4quotas 
| 参数                                            | 参数类型             | 描述   |
|:---|:---|:---|
| [resources] | Array of objects | 资源信息 |
   
 表5resources 
| 参数    | 参数类型    | 描述      |
|:---|:---|:---|
| max   | Integer | 配额最大值。  |
| min   | Integer | 配额最小值。  |
| quota | Integer | 当前配额。   |
| type  | String  | 配额类型。   |
| used  | Integer | 已使用的配额。 |
   
#### 请求示例
查询项目配额。
```
GET https://iam.myhuaweicloud.com/v3.0/OS-QUOTA/projects/{project_id}
```
#### 响应示例
**状态码为 200** **时:**
请求成功。
```
{ 
  "quotas" : { 
                "resources" : [ 
                      { 
                           "max" : 50, 
                           "min" : 0, 
                           "quota" : 10, 
                           "type" : "project", 
                           "used" : 4 
                         } 
                     ] 
               } 
}
```
**状态码为 403** **时:**
没有操作权限。
- 示例 1
```
{ 
   "error_msg" : "You are not authorized to perform the requested action.", 
   "error_code" : "IAM.0002" 
 }
```
- 示例 2
```
{ 
   "error_msg" : "Policy doesn't allow %(actions)s to be performed.", 
   "error_code" : "IAM.0003" 
 }
```
**状态码为 404** **时:**
未找到相应的资源。
```
{
  "error_msg" : "Could not find %(target)s: %(target_id)s.",
  "error_code" : "IAM.0004"
}
```
**状态码为 500** **时:**
内部服务错误。
```
{ 
  "error_msg" : "An unexpected error prevented the server from fulfilling your request.", 
  "error_code" : "IAM.0006" 
}
```
#### 状态码
| 状态码 | 描述        |
|:---|:---|
| 200 | 请求成功。     |
| 401 | 认证失败。     |
| 403 | 没有操作权限。   |
| 404 | 未找到相应的资源。 |
| 500 | 内部服务错误。   |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-iam/iam_02_0006.html)。
