查询IP是否归属于CDN厂商
参数名称 | 描述 |
---|---|
*ipList | ip地址,以英文逗号分隔,每个ip都需要符合正则((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?),ip个数默认不能超过20(可联系技术支持调整) |
参数名称 | 描述 |
---|---|
checkListList | 结果数据 |
responseString | yes:ip属于我司,no:ip不属于我司 |
ipString | ip地址 |
错误代码(code) | 描述(message) | HTTP状态码 | 语义 |
---|---|---|---|
INVALID_HTTP_REQUEST | There was an error in the body of your HTTP request. | 400 | ip没有传递 |
PARAM_TOO_LONG | Param length too long. | 400 | ip个数超过20个 |
PARSE_PARAM_ERROR | parse param error | 400 | ip不符合正则 |
SYSTEM_ERROR | We encountered an system 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/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 }