该接口用于查询单个域名内的各流名的独立IP数量。用户提供具体的域名和时间,获取在此期间指定流的信息(以天为粒度)。接口返回的结果包括域名及其下对应流名的独立IP统计信息。有助于用户了解每路流的访问者分布,从而优化流量配置或评估流媒体服务的使用情况。
参数名称 | 描述 |
---|---|
*dateFromString | 开始时间
1.格式为yyyy-MM-ddTHH:mm:ss+08:00;
2.必须小于当前时间和dateTo;
3.dateFrom和dateTo相差不能超过3天(可联系技术支持调整);
4.只能查询最近2年内数据。 |
*dateToString | 结束时间
1.格式为yyyy-MM-ddTHH:mm:ss+08:00;
2.必须大于dateFrom;
3.查询范围必须包含某一天的00:00:00,才能查询到当天数据,例如查询范围包含 2017-11-07 00:00:00 可以查询到2017-11-07当天数据。 |
参数名称 | 描述 |
---|---|
*domainString | 域名,数量上限1个 |
streamString | 流名:
1.流名个数限制根据账号可调,默认为20个;
2.不传时默认查询域名下所有流名,同时受流名数量上限限制; |
参数名称 | 描述 |
---|---|
resultList | |
domainString | 域名 |
detailsList | |
streamString | 流名 |
timestampString | 时间,格式为yyyy-MM-dd |
totalInteger | 独立IP数 |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
NotAcceptable | The accept header specified in your request is not acceptable. | 400 | Accept请求头不支持,接口仅支持json格式 |
InvalidHTTPRequest | There was an error in the body of your HTTP request. | 400 | 请求体格式错误 |
DateSpanError | You cannot specify a period greater than 3. | 400 | datefrom和dateto相差超过3天 |
InvalidDatePeriod | The date specified is invalid. | 400 | datefrom或dateto不符合规范 |
DomainsExcessive | The number of domain is excessive once. | 403 | 域名数量超出限制 |
StreamsExcessive | The number of stream is excessive once. | 403 | 流名数量超出限制 |
PARAM_INVALID | param: stream is null or invalid. | 400 | 参数stream不符合规范 |
NoSuchDomain | The specified domain does not exist. | 404 | 域名不存在或不属于当前调用账号 |
InternalError | We encountered an internal error. Please try again. | 500 | 系统发生错误 |
#!/bin/bash
# Please remember to change the param (-H "X-Time-Zone") in this demo to the TimeZone you want in response
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://api.cdnetworks.com/api/report/visitor/total/stream?datefrom=2017-11-01T00:00:00%2B08:00&dateto=2017-11-02T00:00:00%2B08:00" \
-X "POST" \
-H "X-Time-Zone:GMT+08:00" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '[
{
"domain":"test.com",
"stream":[
"test.com/abc/steam01"
]
}
]'
{
"result":[
{
"domain":"test.com",
"details":[
{
"stream":"test.com/abc/steam01",
"timestamp":"2017-11-01",
"total":11
},
{
"stream":"test.com/abc/steam01",
"timestamp":"2017-11-02",
"total":22
}
]
}
]
}