直播分发
查询指定时间下域名及流名下的在线人数
Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试
参数名称 | 类型 | 必填 | 描述 |
---|---|---|---|
dateFrom | String | 否 | 开始时间: 1.时间格式为yyyy-MM-ddTHH:mm:ss+08:00 2.不能大于当前时间 3.最多可获取最近半年(183天)的数据 |
dateTo | String | 否 | 结束时间: 1.时间格式yyyy-MM-ddTHH:mm:ss+08:00 2.结束时间需大于开始时间,结束时间如果大于当前时间,取当前时间 3.dateFrom,dateTo二者都未传,默认查询过去的10分钟;如仅有一个未传,抛异常 4.允许查询最大时间间隔1小时:即dateFrom和dateTo相差不能超过1小时。(可联系技术支持调整) |
domainStream | List | 是 | 域名和流名组: 1.可传递的域名和流名组数量上限默认为20组(可联系技术支持调整); 2.域名domain:一组域名和流名组中只能传递单个域名,且域名必须传递; 3.流名stream:一组域名和流名组下(即单个域名下)不限制流名个数,流名未传递时默认查询域名下所有流名 |
domain | String | 是 | 域名 |
stream | List | 否 | 流名:发布点/流名。 例如:live/test-20200101-test.flv ,其中live是发布点, test-20200101-test是流名; 不传,默认查询指定域名下的所有流的数据 |
参数名称 | 类型 | 描述 |
---|---|---|
code | String | 请求结果状态码 |
message | String | 请求结果信息 |
data | List | |
domain | String | 域名 |
streamCount | String | 域名下的流个数 |
totalOnlineCount | String | 该频道下总的在线人数,值为频道下所有流名的在线人数累加 |
streamDetails | List | |
stream | String | 流名 |
onlineCount | String | 该流名对应的在线人数 |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
24102014 | This operation requires a body. Ensure that the body is present and the Content-Type header is set. | 400 | 请求体没有传递 |
24102013 | The accept header specified in your request is not acceptable. | 400 | Accept请求头不支持,接口仅支持json和xml格式,默认为json格式 |
24102020 | The value of X-Time-Zone header specified in your request in invalid. | 400 | 请求头时区不合法 |
24102002 | There was an error in the body of your HTTP request. | 400 | 请求体格式错误 |
24102006 | The date specified is invalid. | 400 | dateFrom或dateTo不符合规范或时间区间不合法 |
24102007 | You cannot specify a period greater than xx minutes. | 400 | dateFrom和dateTo相差超过限制值 |
24102019 | The request was rejected because the number of domain(xx) exceeds the limit (xx). | 400 | 传递的域名个数超过账号限制 |
24102008 | param: domain is null or invalid. | 400 | 参数domain不符合规范 |
24102500 | We encountered an internal error. Please try again. | 500 | 系统发生错误 |
#!/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" } ] } ] }