Get Real-time Usage
Description
This interface can be used to get the real-time push and pull stream concurrency, room concurrency, online user count, maximum room user count, and mixed stream concurrency within the specified time period in the last 2 hours. The data granularity is minutes.
Request method and endpoint
- Request method: GET
- Request URL:
https://analytics-api.zego.im/?Action=GetRealtimeUsage - Transfer protocol: HTTPS
- QPS limit (same AppID): 3 times/minute, 480 times/day
- Data delay: 3 minutes
Request parameters
The following request parameter list only lists the interface request parameters and some common parameters. Please refer to Accessing Server APIs - Public Request Parameters for the complete common parameter list.
| Parameter | Type | Required | Description |
|---|---|---|---|
| Metrics[] | Array of String | Yes | The metrics to be queried:
|
| StartTs | Number | Yes | Start time, UTC timestamp in milliseconds. |
| EndTs | Number | Yes | End time, UTC timestamp in milliseconds. If the push stream is not ended, it can be represented as 0 or the current timestamp to indicate in progress. |
Request Example
https://analytics-api.zego.im/?Action=GetRealtimeUsage
&Metrics[]=publish_concurrent
&Metrics[]=online_user
&StartTs=1672565260000
&EndTs=1672565320000
&<Public Request Parameters>Response Parameters
| Parameter | Type | Description |
|---|---|---|
| Code | Number | Return code. |
| Message | String | Operation result description. |
| RequestId | String | Request ID. |
| Data | Array | Response data. |
| └Metrics | Array of Object | Metric list. |
| └Metric | String | Metric name. |
| └Values | Array of Object | Metric value list. |
| └Timestamp | Number | UTC timestamp in milliseconds. |
| └Value | Number | Metric value. |
Response Example
{
"Code": 0,
"Message": "success",
"Data": {
"Metrics": [
{
"Metric": "publish_concurrent",
"Values": [
{
"Timestamp": 1660634260000,
"Value": 1000
},
{
"Timestamp": 1660634320000,
"Value": 1100
}
]
},
{
"Metric": "online_user",
"Values": [
{
"Timestamp": 1660634260000,
"Value": 99999
},
{
"Timestamp": 1660634320000,
"Value": 99988
}
]
}
]
},
"RequestId": 1660645050860325000
}Return Code
| Return Code | Description | Action |
|---|---|---|
| 0 | Success. | - |
| 500 | Interface error. | Contact ZEGOCLOUD Technical Support. |
| 10001 | Parameter format error. | Check parameters. |
| 10002 | Parameter error or parameter invalid. | Check parameters. |
| 30002 | Interface request frequency exceeds the limit. | Please confirm the QPS limit of the corresponding interface and reduce the request frequency. |
