# DescribeCloudRouterDCToDCTraffic

## 1. 接口描述

调用本接口用于查询三层网络中数据中心到数据中心在指定时间段内的带宽数据。

{% hint style="info" %}
**注意事项**

* 可以通过[DescribeCloudRouters](https://docs.console.zenlayer.com/api-reference/cn/networking/sdn/router/describe-cloud-routers)接口来获取三层网络中接入点的数据中心信息。
* 开始时间和结束时间的跨度不能超过一天。
* 只能查询30天内的流量数据。
* 该接口按数据中心聚合带宽，无法区分同一数据中心内多个接入点各自的流量。例如，查询数据中心A到Z的带宽，返回的是A中所有接入点到Z的总和，不能单独获取某个接入点到另一个接入点的带宽。
  {% endhint %}

## 2. 请求参数

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

<table><thead><tr><th width="158">参数名称</th><th width="85">必选</th><th width="140.85945945945946">类型</th><th>描述</th></tr></thead><tbody><tr><td>cloudRouterId</td><td>是</td><td>String</td><td>三层网络ID。</td></tr><tr><td>sourceDcId</td><td>是</td><td>String</td><td>源数据中心ID。</td></tr><tr><td>destinationDcId</td><td>是</td><td>String</td><td>目的数据中心ID。</td></tr><tr><td>startTime</td><td>是</td><td><a href="../../../api-introduction/instruction/datatype">Timestamp</a></td><td><p>查询开始时间。</p><p>按照<code>ISO8601</code>标准表示，并且使用<code>UTC</code>时间。格式为：<code>YYYY-MM-DDThh:mm:ssZ。</code></p></td></tr><tr><td>endTime</td><td>否</td><td><a href="../../../api-introduction/instruction/datatype">Timestamp</a></td><td><p>查询结束时间。</p><p>按照<code>ISO8601</code>标准表示，并且使用<code>UTC</code>时间。格式为：<code>YYYY-MM-DDThh:mm:ssZ。</code><br><code>默认为当前时间。</code></p></td></tr></tbody></table>

## 3. 响应结果

<table><thead><tr><th width="226">名称</th><th width="186.97126156843643">类型</th><th>描述</th></tr></thead><tbody><tr><td>requestId</td><td>String</td><td><p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p></td></tr><tr><td>dataList</td><td>Array of <a href="../../datastructure#trafficdata">TrafficData</a></td><td>带宽数据列表。</td></tr><tr><td>in95</td><td>Float</td><td>入口带宽95值。</td></tr><tr><td>inAvg</td><td>Integer</td><td>入口带宽平均值。</td></tr><tr><td>inMax</td><td>Integer</td><td>入口带宽最大值。</td></tr><tr><td>inMin</td><td>Integer</td><td>入口带宽最小值。</td></tr><tr><td>out95</td><td>Integer</td><td>出口带宽95值。</td></tr><tr><td>outAvg</td><td>Integer</td><td>出口带宽平均值。</td></tr><tr><td>outMax</td><td>Integer</td><td>出口带宽最大值。</td></tr><tr><td>outMin</td><td>Integer</td><td>出口带宽最小值。</td></tr><tr><td>unit</td><td>String</td><td>带宽值单位。例如：bps。</td></tr></tbody></table>

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}

1. **查询三层网络中数据中心到数据中心一天内的流量数据。**

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

Request:
{
    "cloudRouterId": "your-cloudrouter-id",
    "sourceDcId": "source-dc-id",
    "destinationDcId": "destination-dc-id",
    "startTime": "2026-01-01T00:00:00Z",
    "endTime": "2026-01-01T23:59:59Z"
}

Response:
{
  "requestId": "T4C35327C-7B13-47B8-A815-5E5213D4A9F9",
  "response": {
    "requestId": "T4C35327C-7B13-47B8-A815-5E5213D4A9F9",
    "dataList": [
      {
        "time": "2026-01-01T00:00:00Z",
        "internetRX": 873034,
        "internetTX": 11971
      },
      {
        "time": "2026-01-01T00:05:00Z",
        "internetRX": 873034,
        "internetTX": 11971
      },
      {
        "time": "2026-01-01T00:10:00Z",
        "internetRX": 635218,
        "internetTX": 9028
      }
    ],
    "in95": 873034,
    "inAvg": 793762,
    "inMax": 873034,
    "inMin": 635218,
    "out95": 11971,
    "outAvg": 10990,
    "outMax": 11971,
    "outMin": 9028,
    "unit": "bps"
  }
}
```

{% 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)

<table><thead><tr><th width="146.9764821166095">HTTP状态码</th><th width="313">错误码</th><th>说明</th></tr></thead><tbody><tr><td>404</td><td>INVALID_DATACENTER_NOT_FOUND</td><td>指定的数据中心不存在。</td></tr><tr><td>403</td><td>INVALID_START_TIME_MUST_BEFORE_END_TIME</td><td>开始时间必须在结束时间之前。</td></tr><tr><td>403</td><td>INVALID_TIME_RANGE</td><td>无效的时间范围。查询跨度必须在一天之内。</td></tr><tr><td>403</td><td>TIME_OUT_OF_RANGE</td><td>查询的时间必须在30天之内。</td></tr><tr><td>403</td><td>INVALID_TIME_FORMAT</td><td>无效的时间格式。</td></tr></tbody></table>


---

# 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/networking/sdn/router/describecloudrouterdctodctraffic.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.
