Help Center/ Content Delivery Network/ API Reference/ API/ Analytics/ Querying Operations Report Subscription Tasks by Page
Updated on 2025-09-16 GMT+08:00

Querying Operations Report Subscription Tasks by Page

Function

query subscription task

Calling Method

For details, see Calling APIs.

URI

GET /v1/cdn/statistics/subscription-tasks

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

  • Number of items displayed on each page. If this parameter is left empty or set to 0, the default value 5 is used.

offset

No

Integer

Offset, which is the position where the query starts. The value must be greater than or equal to 0 (default value).

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

total

Integer

Total number of subscription tasks.

data

Array of SubscriptionTask objects

Subscription task.

Table 3 SubscriptionTask

Parameter

Type

Description

id

Long

Subscription task ID.

create_time

Long

Creation time.

update_time

Long

Last update time.

name

String

  • Name of a subscription task.

  • The value contains up to 32 characters, including letters and hyphens (-).

period_type

Integer

  • Type of the subscription task. Possible values:

  • 0: daily report.

  • 1: weekly report.

  • 2: monthly report.

emails

String

Email addresses for receiving operations reports. Email addresses are separated by commas (,).

domain_name

String

List of subscribed domain names, which are separated by commas (.). If this parameter is set to all, operations reports are subscribed to for all domain names under the account.

report_type

String

  • Operations report type. Multiple types are separated by commas (,).

  • 0: access area distribution.

  • 1: country distribution.

  • 2: carrier distribution.

  • 3: domain name rankings (sorted by traffic).

  • 4: popular URLs (sorted by traffic).

  • 5: popular URLs (sorted by the number of requests).

  • 6: popular referers (sorted by traffic).

  • 7: popular referers (sorted by the number of requests).

  • 10: popular origin URLs (sorted by traffic).

  • 11: popular origin URLs (sorted by the number of requests).

  • 13: popular UAs (sorted by traffic).

  • 14: popular UAs (sorted by the number of requests).

Status code: default

Table 4 Response body parameters

Parameter

Type

Description

error

ErrMsg object

Error code and error message.

Table 5 ErrMsg

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

None

Example Responses

None

SDK Sample Code

The SDK sample code is as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.GlobalCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.cdn.v2.region.CdnRegion;
import com.huaweicloud.sdk.cdn.v2.*;
import com.huaweicloud.sdk.cdn.v2.model.*;


public class ListSubscriptionTasksSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new GlobalCredentials()
                .withAk(ak)
                .withSk(sk);

        CdnClient client = CdnClient.newBuilder()
                .withCredential(auth)
                .withRegion(CdnRegion.valueOf("<YOUR REGION>"))
                .build();
        ListSubscriptionTasksRequest request = new ListSubscriptionTasksRequest();
        try {
            ListSubscriptionTasksResponse response = client.listSubscriptionTasks(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import GlobalCredentials
from huaweicloudsdkcdn.v2.region.cdn_region import CdnRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcdn.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = GlobalCredentials(ak, sk)

    client = CdnClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CdnRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListSubscriptionTasksRequest()
        response = client.list_subscription_tasks(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
    cdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := global.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := cdn.NewCdnClient(
        cdn.CdnClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListSubscriptionTasksRequest{}
	response, err := client.ListSubscriptionTasks(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

Success response

default

Abnormal response

Error Codes

See Error Codes.