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.
| Name | Description |
|---|---|
dateFromString | Start date:
1. The time format is yyyy-MM-ddTHH:mm:ss±HH:mm. Please note: ±HH:mm is the time zone offset, which can be adjusted according to your data needs, for example, +00:00 represents UTC time, +08:00 represents East 8th District, and -05:00 represents West 5th District. 2024-01-15T10:30:45+00:00 means UTC time January 15, 2024 10:30:45 AM;
2. Not Greater Than The Current Time
3. Data for the last six months (183 days) are available at most. |
dateToString | End time:
1. The time format is yyyy-MM-ddTHH:mm:ss±HH:mm. Please note: ±HH:mm is the time zone offset, which can be adjusted according to your data needs, for example, +00:00 represents UTC time, +08:00 represents East 8th District, and -05:00 represents West 5th District. 2024-01-15T10:30:45+00:00 means UTC time January 15, 2024 10:30:45 AM;
2. The end time must be greater than the start time. if the end time is greater than the current time, take the current time.
3. Date from, dateTo, neither passed, default query past 24 hours; If there is only one unsent, throw an exception
4. Maximum time interval allowed for queries: 31 days, i.e. the difference between Date from and dateTo cannot exceed 31 days. (Could contact technical support adjustment) |
dataIntervalString | Data granularity
1. Support 1h (1 hour granularity), 1d (1 day granularity);
2. The default is 1h; |
domainList | Domain name:
1. The maximum number of TLDs is 20 by default (Technical Support Adjustment can be contacted);
2. Automatic filtering invalid domain name (if pass illegal domain name, can be filtered, query result only returns the data of valid domain name).
3. No default lookup of all domain names |
| Name | Description |
|---|---|
resultList | result |
domainString | Domain |
peakTimeString | Peak Time |
peakUVString | Peak value of UV |
totalUVString | Total UV |
uvDataList | uvData |
timestampString | time
1. When the data granularity of the query is 1h, the format is yyyy-MM-dd HH; Each time slice data value represents the data value in the previous time granularity range. The time slice at the beginning of the day is yyyy-MM-dd 01, and the last time slice is (yyyy-MM-dd+1) 00;
2. When the data granularity of the query is 1d, the format is yyyy-MM-dd; Each time slice data value represents the value of the data for that date.
3. Return the time slice contained in the start and end times. |
valueString | UV |
| Error code(code) | Description(message) | HTTP status | Semantic |
|---|---|---|---|
| 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"
}
]
}
]
}