Query the number of unique visitors (UV) for multiple domains. Users specify domains and a time range, with data granularity options of 1 hour or 1 day. Results include total UVs per domain, UV peak, and UVs for each time slice, useful for monitoring or analyzing website visits.
| 파라미터 이름 | 설명 |
|---|---|
dateFromString | Start date:
|
dateToString | End time:
|
dataIntervalString | Data granularity
|
domainList | Domain name:
|
| 파라미터 이름 | 설명 |
|---|---|
resultList | result |
domainString | Domain |
peakTimeString | Peak Time |
peakUVString | Peak value of UV |
totalUVString | Total UV |
uvDataList | uvData |
timestampString | time
|
valueString | UV |
| 에러 코드(code) | 설명(message) | HTTP 상태 코드 | 설명 |
|---|---|---|---|
| NotAcceptable | The accept header specified in your request is not acceptable. | 400 | Accept request header not supported, interface supports json and xml format only, default is json format |
| InvalidHTTPRequest | There was an error in the body of your HTTP request. | 400 | Request for physical error |
| InternalError | We encountered an internal error. Please try again. | 500 | We encountered an internal error. Please try again. |
| TimeZoneInvalid | The value of X-Time-Zone header specified in your request in invalid. | 400 | The value of X-Time-Zone header specified in your request in invalid. |
| InvalidDatePeriod | The date specified is invalid. | 400 | The date specified is invalid. |
| PARAM_INVALID | param: domain is null or invalid | 400 | param: domain is null or invalid |
| PARAM_INVALID | param: dataInterval is null or invalid | 400 | param: dataInterval is null or invalid |
| NumberLimitExceeded | The request was rejected because the number of domain(6) exceeds the limit (5). | 400 | The request was rejected because the number of domain(6) exceeds the limit (5). |
#!/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/uv" \
-X "POST" \
-H "X-Time-Zone:GMT+00:00" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '{"dateFrom": "2022-04-13T10:00:00+00:00","dateTo": "2022-04-14T23:00:00+00:00","dataInterval":"1h","domain": ["www.aaa.com","www.bbb.com"]
}'{
"result": [
{
"domain": "www.aaa.com",
"peakTime": "2022-04-13 22",
"peakUV": "13508",
"totalUV": "163592",
"uvData": [
{
"timestamp": "2022-04-13 10",
"value": "11660"
},
{
"timestamp": "2022-04-13 11",
"value": "11814"
},
{
"timestamp": "2022-04-13 12",
"value": "11968"
},
{
"timestamp": "2022-04-13 13",
"value": "12122"
},
{
"timestamp": "2022-04-13 14",
"value": "12276"
},
{
"timestamp": "2022-04-13 15",
"value": "12430"
},
{
"timestamp": "2022-04-13 16",
"value": "12584"
},
{
"timestamp": "2022-04-13 17",
"value": "12738"
},
{
"timestamp": "2022-04-13 18",
"value": "12892"
},
{
"timestamp": "2022-04-13 19",
"value": "13046"
},
{
"timestamp": "2022-04-13 20",
"value": "13200"
},
{
"timestamp": "2022-04-13 21",
"value": "13354"
},
{
"timestamp": "2022-04-13 22",
"value": "13508"
},
{
"timestamp": "2022-04-13 23",
"value": "0"
},
{
"timestamp": "2022-04-14 00",
"value": "0"
},
{
"timestamp": "2022-04-14 01",
"value": "0"
},
{
"timestamp": "2022-04-14 02",
"value": "0"
},
{
"timestamp": "2022-04-14 03",
"value": "0"
},
{
"timestamp": "2022-04-14 04",
"value": "0"
},
{
"timestamp": "2022-04-14 05",
"value": "0"
},
{
"timestamp": "2022-04-14 06",
"value": "0"
},
{
"timestamp": "2022-04-14 07",
"value": "0"
},
{
"timestamp": "2022-04-14 08",
"value": "0"
},
{
"timestamp": "2022-04-14 09",
"value": "0"
},
{
"timestamp": "2022-04-14 10",
"value": "0"
}
]
}
]
}