# DescribeEipTraffic

## 1. 接口描述

本接口(DescribeEipTraffic)用于查询指定弹性公网 IP 在指定时间段内的流量监控数据，支持按统计粒度（step）聚合，可按出口公网 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](/api-reference/cn/compute/zec/datastructure.md#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）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/cn/compute/zec/elastic-ip/describeeiptraffic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
