# DescribeEipTraffic

## 1. 接口描述

本接口(DescribeEipTraffic)用于查询弹性公网IP指定时间段内的流量信息。

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称      | 必选 | 类型      | 描述                                                                            |
| --------- | -- | ------- | ----------------------------------------------------------------------------- |
| eipId     | 是  | String  | 要查询的弹性IP ID。                                                                  |
| startTime | 是  | String  | <p>查询开始时间。</p><p>按照ISO8601标准表示，并且使用UTC时间。</p><p>格式为：YYYY-MM-ddTHH:mm:ssZ。</p> |
| endTime   | 是  | String  | <p>查询结束时间。</p><p>按照ISO8601标准表示，并且使用UTC时间。</p><p>格式为：YYYY-MM-ddTHH:mm:ssZ。</p> |
| step      | 否  | Integer | <p>查询数据点间隔。</p><p>单位为分钟。</p><p>支持参数：1,5。</p><p>默认值：5</p>                      |
| wanIp     | 否  | String  | 指定IP查询，该字段用于三线IP,可以指定IP地址查询流量。                                                |

## 3. 响应结果

| 参数名称      | 类型                                                                                                                 | 描述                                                       |
| --------- | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
| requestId | String                                                                                                             | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| dataList  | Array of [EipTrafficData](https://docs.console.zenlayer.com/api-reference/cn/compute/datastructure#eiptrafficdata) | 查询的数据点。                                                  |
| in95      | Integer                                                                                                            | <p>入方向带宽95值。</p><p>单位：bps。</p>                           |
| inAvg     | Integer                                                                                                            | <p>入方向带宽平均值。</p><p>单位：bps。</p>                           |
| inMax     | Integer                                                                                                            | <p>入方向带宽的最大值。</p><p>单位：bps。</p>                          |
| inMin     | Integer                                                                                                            | <p>入方向带宽的最小值。</p><p>单位：bps。</p>                          |
| inTotal   | Integer                                                                                                            | <p>入方向的总字节。</p><p>单位：Byte。</p>                           |
| out95     | Integer                                                                                                            | <p>出方向带宽95值。</p><p>单位：bps。</p>                           |
| outAvg    | Integer                                                                                                            | <p>出方向带宽平均值。</p><p>单位：bps。</p>                           |
| outMax    | Integer                                                                                                            | <p>出方向带宽最大值。</p><p>单位：bps。</p>                           |
| outMin    | Integer                                                                                                            | <p>出方向带宽最小值。</p><p>单位：bps。</p>                           |
| outTotal  | Integer                                                                                                            | <p>入方向的总字节。</p><p>单位：bps。</p>                            |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 查询EIP一段时间内的流量数据。**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeEipTraffic
<Common Request Params>

Request：
{
  "eipId": "926368879272403391",
  "startTime": "2023-07-11T08:00:011Z",
  "endTime": "2023-07-11T08:10:00Z"
}

Response：
{
  "requestId": "TE1375F34-6DC9-4BED-BDF2-DC9D07E4D3A6",
  "response": {
    "requestId": "TE1375F34-6DC9-4BED-BDF2-DC9D07E4D3A6",
    "dataList": [
      {
        "internetRX": 109096,
        "internetTX": 80,
        "time": "2023-07-11T08:05:00Z"
      },
      {
        "internetRX": 106680,
        "internetTX": 56,
        "time": "2023-07-11T08:10:00Z"
      }
      ...
    ],
    "in95": 109096,
    "inAvg": 107888,
    "inMax": 109096,
    "inMin": 106680,
    "inTotal": 8091600,
    "out95": 80,
    "outAvg": 68,
    "outMax": 80,
    "outMin": 56,
    "outTotal": 5100
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](https://docs.console.zenlayer.com/api-reference/cn/api-introduction/toolkit)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](https://docs.console.zenlayer.com/api-reference/cn/api-introduction/instruction/commonerrorcode)

| HTTP状态码 | 错误码 | 说明 |
| ------- | --- | -- |
