Help Center/ Video On Demand/ API Reference/ Statistical analysis/ Querying Daily Playback Statistics of a Media Asset
Updated on 2024-12-04 GMT+08:00

Querying Daily Playback Statistics of a Media Asset

Function

Queries daily playback statistics of a media asset.

Before using this API, you need to submit a service ticket to enable the statistics function to trigger a statistics task.

Playback statistics of the past year can be queried.

URI

GET /v1/{project_id}/asset/daily-summary

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

start_time

Yes

String

Start time of the period to be queried. You can query data of the past year, and the time span for one query cannot exceed 90 days.

The format of the start time of the period to be queried is yyyyMMdd000000.

end_time

Yes

String

End time of the period to be queried. You can query data of the past year, and the time span for one query cannot exceed 90 days.

The format of the end time of the period to be queried is yyyyMMdd000000.

offset

No

Integer

Offset. The records after this offset will be queried.

limit

No

Integer

Maximum number of records that can be returned.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used.

It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory for AK/SK authentication.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total

Integer

Total records.

summary_results

Array of AssetDailySummaryResult objects

Log files.

Table 5 AssetDailySummaryResult

Parameter

Type

Description

date

String

Playback date. The format is yyyyMMdd000000.

link

String

URL for downloading daily playback statistics files. The validity period is 12 hours.

File content format: [Domain name]\t[Media asset ID]\t[Date]\t[Playback traffic]\t[Playback times]

Description of playback times statistics:

  • HLS files: When M3U8 files are accessed, the number of playback times is counted. When TS files are accessed, the number of playback times is not counted.

  • For other files, such as MP4 files, if the playback request contains range and the value of start in range is not 0, the number of playback times is not counted. In other cases, the number of playback times is counted.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error description

Example Requests

None

Example Responses

Status code: 200

The information is returned when the request succeeded.

{
  "total" : 1,
  "summary_results" : [ {
    "date" : "20231201000000",
    "link" : "http://cdn-log-user-bj4.obs.cn-north-4.myhuaweicloud.com:80/asset-play-summary/05a8aee14d8026a92fcdc018fe235c2c/20231201-asset-play-summary.gz?AccessKeyId=QXBNBGA2GW9EP2XXOYUN&Expires=1701786544&Signature=kZYh0hEos2V**********AHGyXA%3D"
  } ]
}

Status code: 400

The information is returned when the request failed.

{
  "error_code" : "VOD.10053",
  "error_msg" : "The request parameter is illegal, illegal field: {xx}."
}

Status Codes

Status Code

Description

200

The information is returned when the request succeeded.

400

The information is returned when the request failed.

Error Codes

See Error Codes.