Help Center/ SparkRTC/ API Reference/ Statistical Analysis/ Querying Historical Scale Data
Updated on 2022-10-08 GMT+08:00

Querying Historical Scale Data

Function

This API is used to query scale data of indicators of each day in the last 31 days. You cannot obtain the number of rooms and users of the current day.

The maximum query time span is 31 days.

URI

GET /v1/{project_id}/rtc/history/scale

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

app

Yes

String

Application identifier.

metric

Yes

Array

Data type.

  • UserCount: number of users in calls. The users with the same user ID in different channels are counted as different users.

  • SessionCount: number of calls. Each time a user joins a channel, a call is counted.

  • RoomCount: number of rooms. A call room is counted from the time when a user joins a room to the time when all users leave the room.

  • MaxOnlineUserCount: maximum number of concurrent online users

  • MaxOnlineRoomCount: maximum number of online rooms

  • CommunicationDuration: audio and video call duration

  • VideoCommunicationDuration: video call duration

  • AudioCommunicationDuration: audio call duration

start_date

No

String

Start time of the query (UTC time in the format of YYYY-MM-DD, for example, 2020-04-23). If this parameter is not specified, the data of the last day is read by default.

end_date

No

String

Queries end time. UTC time in the format of YYYY-MM-DD, for example, 2020-04-23.

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. The token 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 the user token.

Authorization

No

String

Authentication information. This parameter is mandatory when AK/SK-based authentication is used.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory when AK/SK-based authentication is used.

X-Project-Id

No

String

Project ID, which is the same as that used in the URI. This parameter is mandatory when AK/SK-based authentication is used.

Response Parameters

Status code: 200

Table 4 Response header parameters

Parameter

Type

Description

X-Request-Id

String

Unique ID of the request.

Table 5 Response body parameters

Parameter

Type

Description

scale

Array of RtcHistoryScaleTimeValue objects

Timestamp and indicator value list at the corresponding time

Table 6 RtcHistoryScaleTimeValue

Parameter

Type

Description

date

String

Sampling time. The format must comply with the ISO 8601 standard (UTC time). The format is YYYY-MM-DD.

user_count

Long

Number of users in a call, that is, the total number of UIDs.

session_count

Long

Total number of sessions.

room_count

Long

Number of rooms.

max_online_user_count

Long

Maximum number of concurrent online users.

max_online_room_count

Long

Maximum number of concurrent online rooms.

communication_duration

Long

Total audio and video duration, in seconds.

video_communication_duration

Long

Total video duration, in seconds.

audio_communication_duration

Long

Total audio duration, in seconds.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

GET /v1/{project_id}/rtc/history/scale?app=5fa682b34a974f7ad24d223b&metric=SessionCount,MaxOnlineRoomCount&start_date=2020-04-23&end_date=2020-04-26

Example Responses

Status code: 200

This status code is returned if the request succeeds.

{
  "scale" : [ {
    "date" : "2020-06-04",
    "user_count" : 1,
    "session_count" : 1,
    "room_count" : 3,
    "max_online_user_count" : 5,
    "max_online_room_count" : 4,
    "communication_duration" : 123,
    "video_communication_duration" : 234,
    "audio_communication_duration" : 132
  } ]
}

Status code: 400

This status code is returned if the request fails.

{
  "error_code" : "DATA.100011001",
  "error_msg" : "Required String parameter 'app' is not present"
}

Status Codes

Status Code

Description

200

This status code is returned if the request succeeds.

400

This status code is returned if the request fails.

Error Codes

See Error Codes.