文档中心 API文档 查询HLS流在线人数

查询HLS流在线人数

更新时间:2023-04-28 15:36:31

适用产品

直播分发

接口描述

查询指定时间下域名及流名下的在线人数

推荐使用 Open API在线调试

Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试

请求参数

Body 参数

参数名称描述
dateFromString
开始时间: 1.时间格式为yyyy-MM-ddTHH:mm:ss+08:00 2.不能大于当前时间 3.最多可获取最近半年(183天)的数据
dateToString
结束时间: 1.时间格式yyyy-MM-ddTHH:mm:ss+08:00 2.结束时间需大于开始时间,结束时间如果大于当前时间,取当前时间 3.dateFrom,dateTo二者都未传,默认查询过去的10分钟;如仅有一个未传,抛异常 4.允许查询最大时间间隔1小时:即dateFrom和dateTo相差不能超过1小时。(可联系技术支持调整)
*domainStreamList
域名和流名组: 1.可传递的域名和流名组数量上限默认为20组(可联系技术支持调整); 2.域名domain:一组域名和流名组中只能传递单个域名,且域名必须传递; 3.流名stream:一组域名和流名组下(即单个域名下)不限制流名个数,流名未传递时默认查询域名下所有流名
*domainString
域名
streamList
流名:发布点/流名。 例如:live/test-20200101-test.flv ,其中live是发布点, test-20200101-test是流名; 不传,默认查询指定域名下的所有流的数据

返回参数

Body 参数

参数名称描述
codeString
请求结果状态码
messageString
请求结果信息
dataList
domainString
域名
streamCountString
域名下的流个数
totalOnlineCountString
该频道下总的在线人数,值为频道下所有流名的在线人数累加
streamDetailsList
streamString
流名
onlineCountString
该流名对应的在线人数

错误码

错误代码(code)描述(message)HTTP状态码语义
24102014This operation requires a body. Ensure that the body is present and the Content-Type header is set.400请求体没有传递
24102013The accept header specified in your request is not acceptable.400Accept请求头不支持,接口仅支持json和xml格式,默认为json格式
24102020The value of X-Time-Zone header specified in your request in invalid.400请求头时区不合法
24102002There was an error in the body of your HTTP request.400请求体格式错误
24102006The date specified is invalid.400dateFrom或dateTo不符合规范或时间区间不合法
24102007You cannot specify a period greater than xx minutes.400dateFrom和dateTo相差超过限制值
24102019The request was rejected because the number of domain(xx) exceeds the limit (xx).400传递的域名个数超过账号限制
24102008param: domain is null or invalid.400参数domain不符合规范
24102500We encountered an internal error. Please try again.500系统发生错误

示例

JSON
JSON
请求示例
复制代码 复制成功
#!/bin/bash
username="example_username"
apiKey="example_apiKey"
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://open.chinanetcenter.com/api/report/hls/online" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '{
    "dateFrom": "2021-08-16T00:00:00+08:00",
    "dateTo": "2021-08-16T01:00:00+08:00",
    "domainStream": [
        {
            "domain": "www.test.com",
            "stream": [
                "live/test-20200101-test.flv"
            ]
        }
    ]
}'
返回示例
复制代码 复制成功
{
    "code": "0",
    "message": "success",
    "data": [
        {
            "domain": "www.test.com",
            "streamCount": "1",
            "totalOnlineCount": "15000",
            "streamDetails": [
                {
                    "stream": "test/stream1",
                    "onlineCount": "15000"
                }
            ]
        }
    ]
}
本篇文档内容对您是否有帮助?
有帮助
我要反馈
提交成功!非常感谢您的反馈,我们会继续努力做到更好!