查询域名粒度用量,数据只支持东九区时区
参数名称 | 描述 |
---|---|
*dateFrom | 开始时间 1.格式为yyyy-MM-dd; 2.并且小于当前时间和dateTo; 3.只能查询最近2年内数据;4.dateFrom和dateTo相差不能超过31天; |
*dateTo | 结束时间 1.格式为yyyy-MM-dd; 2.必须大于dateFrom; 3.如果大于当前时间,则重新赋值为当前时间; |
*domain | 域名,仅支持传单个域名 |
*contract | 域名所属合同,仅支持传一个合同 |
type | 数据粒度:
h:小时粒度
d:天粒度
不传默认为天粒度 |
参数名称 | 描述 |
---|---|
domain | 域名 |
usage | |
timestamp | 时间,格式是 yyyy-MM-dd HH:mm |
usage | 用量,单位为byte |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
24102006 | The date specified is invalid. | 400 | dateFrom或dateTo不符合规范或时间区间不合法 |
24102021 | Date format error. | 400 | 日期格式错误 |
24102008 | param: domain is null or invalid. | 400 | 参数domain不符合规范 |
24102500 | We encountered an internal error. Please try again. | 500 | 系统发生错误 |
24102023 | Failed to get ids. Please check the domain. | 400 | 域名错误 |
24102023 | Invalid parameters. Please check the 'contract' or 'dateFrom' or 'dateTo'. | 400 | 合同号错误 |
34102022 | No contract permission | 400 | 没有合同权限 |
24102008 | Domain not found | 400 | 该合同下没有这个域名 |
#!/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/domain-usage" \ -X "POST" \ -u "$username:$password" \ -H "Date: $date" \ -H "Accept: application/json" \ -d '{"dateFrom":"2022-08-01","dateTo":"2022-08-05","domain":"edu.xxx.net","type":"d"}'
{ "code": "0", "message": "success", "data": [ { "timestamp": "2022-08-01", "usage": "2135" }, { "timestamp": "2022-08-02", "usage": "2135" }, { "timestamp": "2022-08-03", "usage": "2141" }, { "timestamp": "2022-08-04", "usage": "2141" }, { "timestamp": "2022-08-05", "usage": "2141" } ] }