直播分发
查询多域名多流名的推流时长
单用户调用频率:300/5min
Open API在线调试功能提供可视化界面在线调试API、支持生成代码示例、快速检索查看API文档等能力。前往调试
参数名称 | 类型 | 必填 | 描述 |
---|---|---|---|
dateFrom | String | 否 | 开始时间: 1.时间格式为yyyy-MM-dd,例如,2021-08-10 2.不能大于当前时间 3.只能查询最近半年内数据。 |
dateTo | String | 否 | 结束时间: 1.时间格式为yyyy-MM-dd 2.结束时间需大于开始时间,结束时间如果大于当前时间,取当前时间 3.dateFrom,dateTo二者都未传,默认查询过去的7天;如仅有一个未传,抛异常 4.允许查询最大时间间隔:31天,即dateFrom和dateTo相差不能超过31天。 |
domainStream | List | 否 | - |
domain | String | 否 | 域名: 1、可传递域名数量上限默认为1个; 2、自动过滤掉无效域名(如传递非法域名,会被过滤掉,查询结果只返回有效域名的数据)。 |
stream | List | 否 | 流名: 只需要传发布点+流名,例如:live/test-20180101-test ,其中live是发布点,test-20180101-test是流名 |
参数名称 | 类型 | 描述 |
---|---|---|
code | String | 请求结果状态码 |
message | String | 请求结果信息 |
data | List | 请求结果的详细数据 |
domain | String | 域名 |
streamList | List | - |
stream | String | 流名(域名+发布点+流名) |
sumTime | Number | 对应时间段内流名推流时长之和,单位为毫秒 |
durationDetailList | List | - |
startTime | String | 推流起始时间 |
endTime | String | 推流终止时间 |
duration | Number | 推流时长,单位为毫秒 |
错误代码(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 day(s). | 400 | dateFrom和dateTo相差超过限制值 |
24102008 | param:domain is null or invalid. | 400 | 参数domain不符合规范 |
24102019 | The request was rejected because the number of Domain(xx) exceeds the limit (xx). | 400 | 传递的域名个数超过账号限制 |
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/domain/stream/duration" \ -X "POST" \ -u "$username:$password" \ -H "Date: $date" \ -H "Accept: application/json" \ -d '{ "dateFrom": "2021-08-10", "dateTo": "2021-08-12", "domainStream": [ { "domain": "www.a.com", "stream":[ "test/steam0", "test/steam1" ] }, { "domain": "www.b.com", "stream":[ "test/steam0", "test/steam1" ] } ] }'
{{ "code": "0", "message": "success", "data": [ { "domain": "www.a.com", "streamList": [ { "stream": "www.a.com/test/steam0", "sumTime": 1500000, "durationDetailList": [ { "startTime": "1628532000", "endTime": "1628532300", "duration": 300000 }, { "startTime": "1628528400", "endTime": "1628529000", "duration": 600000 }, { "startTime": "1628697600", "endTime": "1628698600", "duration": 600000 } ] }, { "stream": "www.b.com/test/steam1", "sumTime": 1200000, "durationDetailList": [ { "startTime": "1628697600", "endTime": "1628699600", "duration": 600000 }, { "startTime": "1628528400", "endTime": "1628529000", "duration": 600000 } ] } ] } ] }