tencent cloud

文档反馈

DescribeCDNUsageData

最后更新时间:2024-03-27 16:08:10

    1. API Description

    Domain name for API request: vod.tencentcloudapi.com.

    This API is used to query the CDN statistics of VOD such as traffic and bandwidth.

    1. Only CDN usage data for the last 365 days can be queried.
    2. The query time range cannot be more than 90 days.
    3. The time granularity of usage data can be specified, including 5-minute, 1-hour, and 1-day.
    4. Traffic refers to the total traffic within the query time granularity, while bandwidth the peak bandwidth.

    A maximum of 100 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: DescribeCDNUsageData.
    Version Yes String Common Params. The value used for this API: 2018-07-17.
    Region No String Common Params. This parameter is not required.
    StartTime Yes String Start date in ISO date format.
    EndTime Yes String End date in ISO date format. The end date must be after the start date.
    DataType Yes String CDN statistics type. Valid values:
  • Flux: traffic in bytes.
  • Bandwidth: bandwidth in bps.
  • SubAppId No Integer The VOD application ID. For customers who activate VOD service from December 25, 2023, if they want to access resources in a VOD application (whether it's the default application or a newly created one), they must fill in this field with the application ID.
    DataInterval No Integer Time granularity of usage data in minutes. Valid values:
  • 5: 5-minute granularity. The data at 5-minute granularity in the query period will be returned.
  • 60: 1-hour granularity. The data at 1-hour granularity in the query period will be returned.
  • 1440: 1-day granularity. The data at 1-day granularity in the query period will be returned.

  • Default value: 1440. Data at 1-day granularity will be returned.
    DomainNames.N No Array of String List of domain names. The usage data of up to 20 domain names can be queried at a time. You can specify multiple domain names and query their combined usage data. The usage data of all domain names will be returned by default.

    3. Output Parameters

    Parameter Name Type Description
    DataInterval Integer Time granularity in minutes.
    Data Array of StatDataItem CDN statistics.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Querying CDN traffic statistics of VOD

    This example shows you how to query CDN traffic statistics between December 1, 2018 (inclusive) and December 3, 2018 (inclusive).

    Input Example

    https://vod.tencentcloudapi.com/?Action=DescribeCDNUsageData
    &StartTime=2018-12-01T00:00:00+08:00
    &EndTime=2018-12-03T00:00:00+08:00
    &DataType=Flux
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "DataInterval": 1440,
            "Data": [
                {
                    "Time": "2018-12-01T00:00:00+08:00",
                    "Value": 1000000
                },
                {
                    "Time": "2018-12-02T00:00:00+08:00",
                    "Value": 1500000
                },
                {
                    "Time": "2018-12-03T00:00:00+08:00",
                    "Value": 1500000
                }
            ],
            "RequestId": "requestId"
        }
    }
    

    Example2 This example shows you how to query bandwidth statistics (5-minute granularity) of the domain names 123.vod2.myqcloud.com and test.a.com between December 1, 2018 and December 3, 2018.

    This example shows you how to query CDN traffic statistics between December 1, 2018 (inclusive) and December 3, 2018 (inclusive).

    Input Example

    https://vod.tencentcloudapi.com/?Action=DescribeCDNUsageData
    &DomainNames.0=123.vod2.myqcloud.com
    &DomainNames.1=test.a.com
    &StartTime=2018-12-01T00:00:00+08:00
    &EndTime=2018-12-03T00:00:00+08:00
    &DataType=Bandwidth
    &DataInterval=5
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "DataInterval": 5,
            "Data": [
                {
                    "Time": "2018-12-01T00:00:00+08:00",
                    "Value": 100000
                },
                {
                    "Time": "2018-12-01T05:00:00+08:00",
                    "Value": 200000
                },
                {
                    "Time": "2018-12-01T10:00:00+08:00",
                    "Value": 350000
                }
            ],
            "RequestId": "requestId"
        }
    }
    

    Example3 Querying bandwidth statistics of all domain names between December 1, 2018 and December 3, 2018 by an admin

    Input Example

    https://vod.tencentcloudapi.com/?Action=DescribeCDNUsageData
    &StartTime=2018-12-01T00:00:00+08:00
    &EndTime=2018-12-03T00:00:00+08:00
    &DataType=Bandwidth
    &SubAppId=1
    &<Common request parameters>
    

    Output Example

    {
        "Response": {
            "DataInterval": 1440,
            "Data": [
                {
                    "Time": "2018-12-01T00:00:00+08:00",
                    "Value": 700000
                },
                {
                    "Time": "2018-12-01T05:00:00+08:00",
                    "Value": 800000
                },
                {
                    "Time": "2018-12-01T10:00:00+08:00",
                    "Value": 920000
                }
            ],
            "RequestId": "requestId"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation Operation failed.
    FailedOperation.InvalidVodUser The VOD service is not activated.
    FailedOperation.NetWorkError Network error.
    InternalError Internal error.
    InvalidParameterValue Incorrect parameter value.
    InvalidParameterValue.DataInterval Incorrect parameter value: time granularity.
    InvalidParameterValue.DataType Incorrect parameter value: data type.
    InvalidParameterValue.DomainName Invalid parameter: the domain name does not exist.
    InvalidParameterValue.DomainNames Parameter value. The domain name list is too large.
    InvalidParameterValue.EndTime Incorrect parameter value: invalid EndTime.
    InvalidParameterValue.StartTime Incorrect parameter value: invalid StartTime.
    UnauthorizedOperation Unauthorized operation.