
# 查询所有集成应用的指标统计值TopN - ListRomaAppUsagesTopN
#### 功能介绍
查询统计时长内所有集成应用的指标统计值TopN，要求主账号权限。
受限使用，如有疑问请联系技术工程师。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/ROMA/doc?api=ListRomaAppUsagesTopN)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-roma/roma_06_0018.html)。
#### URI
GET /v2/{project_id}/apic/instances/{instance_id}/statistics/roma-app-usages
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                                  |
|:---|:---|:---|:---|
| project_id  | 是    | String | 项目ID，获取方式请参见API参考的"附录 \> 获取项目ID"章节。 |
| instance_id | 是    | String | 实例ID                                |
表2Query参数 
| 参数               | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
|:---|:---|:---|:---|
| cycle            | 否    | String  | 查询统计周期 - minute：分钟 - hour：小时 - day：天 cycle=minute时，支持查询最近30天的数据 cycle=hour时，支持查询最近180天的数据 cycle=day时，支持查询最近360天的数据                                                                                                                                                                                                                                                                                                                                     |
| start_time       | 否    | String  | 开始时间，格式：2020-06-18 10:00:01                                                                                                                                                                                                                                                                                                                                                                                                                            |
| end_time         | 否    | String  | 结束时间，格式：2020-06-18 23:00:00                                                                                                                                                                                                                                                                                                                                                                                                                            |
| duration         | 否    | String  | 统计时长格式：整数+单位（m、h），m：分钟，h：小时，可支持小时与分钟的组合。例如：1h或2h45m - 同时给定start_time和end_time优先查询\[start_time, end_time\] - start_time不存在，end_time和duration存在且合法，则查询区间为\[end_time - duration, end_time\] - start_time和end_time不存在，duration存在且合法，令end_time=now，则查询区间为\[end_time - duration, end_time\] - end_time不存在，start_time和duration存在且合法，令end_time=now，则查询区间为\[end_time - duration, end_time\] - start_time，end_time和duration都不存在，报错missing time range parameters。 |
| top_roma_app_num | 否    | Integer | 集成应用的topN                                                                                                                                                                                                                                                                                                                                                                                                                                              |
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数                      | 参数类型                                                                                                           | 描述                      |
|:---|:---|:---|
| code                    | String                                                                                                         | 响应码                     |
| start_time              | Long                                                                                                           | 统计起始时间UTC的时间戳           |
| end_time                | Long                                                                                                           | 统计结束时间UTC的时间戳           |
| app_req_count           | Array of [AppRequestStatisticInfo] objects           | 应用请求次数TOP_n统计信息列表       |
| app_req_count_error     | Array of [AppRequestErrorStatisticInfo] objects | 应用请求错误次数TOP_n统计信息列表     |
| app_input_throughput    | Array of [AppInputStatisticInfo] objects               | 应用请求上行吞吐量TOP_n统计信息列表    |
| app_output_throughput   | Array of [AppOutputStatisticInfo] objects             | 应用请求下行吞吐量TOP_n统计信息列表    |
| app_avg_latency         | Array of [AppAvgLatencyInfo] objects                       | 应用平均时延时间TOP_n统计信息列表     |
| app_avg_backend_latency | Array of [AppAvgBackendLatencyInfo] objects         | 应用请求平均后端时延时间TOP_n统计信息列表 |
   
 表5AppRequestStatisticInfo 
| 参数        | 参数类型    | 描述     |
|:---|:---|:---|
| app_id    | String  | 调用应用编号 |
| app_name  | String  | 应用名称   |
| req_count | Integer | 请求总次数  |
   
 表6AppRequestErrorStatisticInfo 
| 参数              | 参数类型    | 描述     |
|:---|:---|:---|
| app_id          | String  | 调用应用编号 |
| app_name        | String  | 应用名称   |
| req_count_error | Integer | 请求错误次数 |
   
 表7AppInputStatisticInfo 
| 参数               | 参数类型   | 描述      |
|:---|:---|:---|
| app_id           | String | 调用应用编号  |
| app_name         | String | 应用名称    |
| input_throughput | Long   | 上行吞吐量汇总 |
   
 表8AppOutputStatisticInfo 
| 参数                | 参数类型   | 描述      |
|:---|:---|:---|
| app_id            | String | 调用应用编号  |
| app_name          | String | 应用名称    |
| output_throughput | Long   | 下行吞吐量汇总 |
   
 表9AppAvgLatencyInfo 
| 参数          | 参数类型   | 描述     |
|:---|:---|:---|
| app_id      | String | 调用应用编号 |
| app_name    | String | 应用名称   |
| avg_latency | Float  | 平均时延时间 |
   
 表10AppAvgBackendLatencyInfo 
| 参数                  | 参数类型   | 描述       |
|:---|:---|:---|
| app_id              | String | 调用应用编号   |
| app_name            | String | 应用名称     |
| avg_backend_latency | Float  | 平均后端时延时间 |
   
**状态码：400**
表11响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：401**
表12响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：403**
表13响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：404**
表14响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：500**
表15响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
#### 请求示例
无
#### 响应示例
**状态码：200**
OK
```
{
  "code" : "APIG.0000",
  "start_time" : 1599508511,
  "end_time" : 1599616511,
  "app_req_count" : [ {
    "app_id" : "1a7b421c-6103-4fcb-a0d7-3e322e863cb0",
    "app_name" : "ycs-product",
    "req_count" : 5
  } ],
  "app_req_count_error" : [ {
    "app_id" : "1a7b421c-6103-4fcb-a0d7-3e322e863cb0",
    "app_name" : "ycs-product",
    "req_count" : 5
  } ],
  "app_input_throughput" : [ {
    "app_id" : "1a7b421c-6103-4fcb-a0d7-3e322e863cb0",
    "app_name" : "ycs-product",
    "input_throughput" : 2990
  } ],
  "app_output_throughput" : [ {
    "app_id" : "1a7b421c-6103-4fcb-a0d7-3e322e863cb0",
    "app_name" : "ycs-product",
    "output_throughput" : 1695
  } ],
  "app_avg_latency" : [ {
    "app_id" : "1a7b421c-6103-4fcb-a0d7-3e322e863cb0",
    "app_name" : "ycs-product",
    "avg_latency" : 0
  } ],
  "app_avg_backend_latency" : [ {
    "app_id" : "1a7b421c-6103-4fcb-a0d7-3e322e863cb0",
    "app_name" : "ycs-product",
    "avg_backend_latency" : 0
  } ]
}
```
**状态码：400**
Bad Request
```
{
  "error_code" : "APIG.2012",
  "error_msg" : "Invalid parameter value,parameterName:api_id. Please refer to the support documentation"
}
```
**状态码：401**
Unauthorized
```
{
  "error_code" : "APIG.1002",
  "error_msg" : "Incorrect token or token resolution failed"
}
```
**状态码：403**
Forbidden
```
{
  "error_code" : "APIG.1005",
  "error_msg" : "No permissions to request this method"
}
```
**状态码：404**
Not Found
```
{
  "error_code" : "APIG.3002",
  "error_msg" : "API 39bce6d25a3f470e8cf7b2c97174f7d9 does not exist"
}
```
**状态码：500**
Internal Server Error
```
{
  "error_code" : "APIG.9999",
  "error_msg" : "System error"
}
```
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK                    |
| 400 | Bad Request           |
| 401 | Unauthorized          |
| 403 | Forbidden             |
| 404 | Not Found             |
| 500 | Internal Server Error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-roma/ErrorCode.html)。
