Help Center/ Content Delivery Network/ API Reference/ API/ Analytics/ Setting an Analytics Configuration
Updated on 2025-09-05 GMT+08:00

Setting an Analytics Configuration

Function

  • This API is used to set an Analytics configuration.

Calling Method

For details, see Calling APIs.

URI

POST /v1/cdn/statistics/stats-configs

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

config_type

No

Integer

Configuration type. 0: popular content statistics.

resource_type

Yes

String

Resource type. domain:resource_name: domain name. account:resource_name: account.

resource_name

Yes

String

Resource name, which is an account or a list of domain names. Separate domain names with commas (,).

config_info

Yes

config_info object

Configuration information. Top N metrics support only user agent, referer, URL, and origin URL.

expired_time

No

Long

Time when the Analytics configuration expires. The value is a timestamp in seconds. The time cannot be one year later than the current time.

Table 2 config_info

Parameter

Mandatory

Type

Description

url

No

TopUrlinReq object

top_url configuration.

ua

No

TopUa object

top_ua configuration.

Table 3 TopUrlinReq

Parameter

Mandatory

Type

Description

enable

No

Boolean

Configuration status.

Table 4 TopUa

Parameter

Mandatory

Type

Description

enable

No

Boolean

Configuration status.

Response Parameters

Status code: 204

Success response.

Status code: default

Table 5 Response body parameters

Parameter

Type

Description

error

ErrMsg object

Error code and error message.

Table 6 ErrMsg

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Creating an Analytics configuration

post https://cdn.myhuaweicloud.com/v1/cdn/statistics/stats-configs

{
  "config_type" : 0,
  "resource_type" : "www.example.com",
  "resource_name" : "all",
  "config_info" : {
    "url" : {
      "enable" : true
    },
    "ura" : {
      "enable" : true
    }
  },
  "expired_time" : 1712678400
}

Example Responses

None

Status Codes

Status Code

Description

204

Success response.

default

Error response.

Error Codes

See Error Codes.