CDN加速

文档中心 API文档 工具服务 查询是否我司IP

查询是否我司IP

更新时间:2021-06-08 09:48:26

适用产品:通用功能

接口描述

查询IP是否归属于CDN厂商的IP。

请求参数

JSON
参数名称类型必填描述
ipStringip地址,以英文逗号分隔,每个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(可联系技术支持调整)

返回参数

JSON
参数名称类型描述
checkListArray查询列表
ipStringip地址
responseStringyes:ip属于我司,no:ip不属于我司

错误码

错误代码(code)描述(message)HTTP状态码语义
INVALID_HTTP_REQUESTThere   was an error in the body of your HTTP request.400ip没有传递
PARAM_TOO_LONGParam   length too long.400ip个数超过20个
PARSE_PARAM_ERRORparse param error400ip不符合正则
SYSTEM_ERRORWe encountered an system error. Please try again.500系统发生错误

示例

JSON
示例说明
请求示例
复制
#!/bin/bash
# 请将示例中的(-H "X-Time-Zone") 参数设置为您希望在返回结果中获得的时区
# 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://open.chinanetcenter.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
  }