Querying Bandwidth Data

Function

This API is used to query bandwidth data of a streaming domain name.

URI

GET /v1/{project_id}/stream/bandwidth

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see "Obtaining a Project ID" .

Table 2 Query parameters

Parameter

Mandatory

Type

Description

domain

No

String

Streaming domain name. If no domain names are specified, the total bandwidth of all domain names in each account is queried.

start_time

No

String

Start time in the format of yyyy-MM-ddTHH:mm:ssZ (UTC time)

end_time

No

String

End time in the format of yyyy-MM-ddTHH:mm:ssZ (UTC time).

  • If neither start_time nor end_time is set, the server queries data over the past statistical period.

  • If start_time is set but end_time is not, the current time is used as end_time.

  • If end_time is set but start_time is not, the request is invalid. You can query data over the past three months.

  • The time span between start_time and end_time cannot be greater than 30 days.

step

No

Integer

Statistical period Unit: minute

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

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

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total

Integer

Total number of elements in the query result

bandwidth_info

Array of BandwidthInfo objects

Bandwidth information

Table 5 BandwidthInfo

Parameter

Type

Description

bw_bps

Integer

Peak bandwidth, in bit/s

timestamp

String

Start time of a sampling period. The value is UTC time in the format of yyyy-MM-ddTHH:mm:ssZ.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description

Example Requests

GET https://{endpoint}/v1/{project_id}/stream/bandwidth?domain=play.example.huawei.com

Example Responses

Status code: 200

Bandwidth data queried successfully.

{
  "total" : 1,
  "bandwidth_info" : [ {
    "bw_bps" : 1024,
    "timestamp" : "2018-05-19T21:10:15Z"
  } ]
}

Status code: 400

Failed to query bandwidth data.

{
  "error_code" : "LIVE.100011001",
  "error_msg" : "Request Illegal"
}

Status Codes

Status Code

Description

200

Bandwidth data queried successfully.

400

Failed to query bandwidth data.

Error Codes

See Error Codes.