Query whether a given IP address belongs to our CDN IP. The user needs to provide a list of IP addresses. The returned result includes whether each IP address belongs to our CDN IP.
Name | Description |
---|---|
*ipList | IP address, use English comma to separate two items. Every IP address needs to following regular expression rule of ((2[0-4]\\d|25[0-5]|1\\d\\d|0|[1-9]\\d?)\\.){3}(2[0-4]\\d|25[0-5]|1\\d\\d|0|[1-9]\\d?). The default number of IPs cannot exceed 20 (you can contact technical support to adjust) . |
Name | Description |
---|---|
checkListList | checkList |
responseString | yes: the IP belongs to Our system,
no: the IP does not belong to Our system |
ipString | IP addresses |
Error code(code) | Description(message) | HTTP status | Semantic |
---|---|---|---|
INVALID_HTTP_REQUEST | There was an error in the body of your HTTP request. | 400 | IP has not been specified |
PARAM_TOO_LONG | Param length too long. | 400 | Number of queried IP exceeds 20 |
PARSE_PARAM_ERROR | parse param error | 400 | IP does not conform to regular expression rules |
SYSTEM_ERROR | We encountered an system error. Please try again. | 500 | System error |
#!/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/si/tools/ipCheck" \
-X "POST" \
-H "X-Time-Zone:GMT+08:00" \
-u "$username:$password" \
-H "Date: $date" \
-H "Accept: application/json" \
-d '{
"ip":["1.1.1.1","2.2.2.2"]
}'
{
"result": {
"checkList": [
{
"response": "no",
"ip": "1.1.1.1"
},
{
"response": "no",
"ip": "2.2.2.2"
}
]
},
"code": 200
}