网络查询

查询 ASN RDAP

GET/rdap/asn
公开访问

按 IANA asn.json 的最窄号码区间选择注册局,查询 ASN RDAP。只使用 HTTPS,不查询 WHOIS。 访问类别:匿名 API,可携带 Token 使用独立额度

请求参数

asnquery必填
0 到 4294967295 的 ASN,可带 AS 前缀
string · 0 到 4294967295 的 ASN,可带 AS 前缀 · 格式:^(?:AS|as)?(?:0|[1-9]\d{0,9})$
rawquery
true 时在 raw 返回注册局原始 RDAP JSON
string · true 时在 raw 返回注册局原始 RDAP JSON · 默认值:"false" · 可选:true、false

响应

200 ASN 注册数据。成功结果缓存 300 秒。

application/json

{
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "enum": [
        "domain",
        "ip",
        "asn"
      ]
    },
    "query": {
      "type": "string"
    },
    "service": {
      "type": "string",
      "description": "命中的 IANA 引导项,例如 com、8.0.0.0/8 或 13312-15359"
    },
    "registry": {
      "type": "string",
      "description": "选中的 HTTPS RDAP 基址"
    },
    "objectClass": {
      "type": "string"
    },
    "handle": {
      "type": [
        "string",
        "null"
      ]
    },
    "name": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "dates": {
      "type": "object",
      "properties": {
        "registration": {
          "type": [
            "string",
            "null"
          ]
        },
        "expiration": {
          "type": [
            "string",
            "null"
          ]
        },
        "lastChanged": {
          "type": [
            "string",
            "null"
          ]
        },
        "lastUpdateOfRdap": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "registration",
        "expiration",
        "lastChanged",
        "lastUpdateOfRdap"
      ],
      "description": "保留注册局返回的时间原文;缺失为 null"
    },
    "events": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "action": {
            "type": "string"
          },
          "date": {
            "type": "string"
          }
        },
        "required": [
          "action",
          "date"
        ]
      }
    },
    "entities": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "handle": {
            "type": [
              "string",
              "null"
            ]
          },
          "roles": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "name": {
            "type": [
              "string",
              "null"
            ]
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "handle",
          "roles",
          "name",
          "kind"
        ]
      }
    },
    "nameservers": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "ipv4": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "ipv6": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "ipv4",
          "ipv6"
        ]
      },
      "description": "仅域名对象提供;IP 与 ASN 为 null"
    },
    "network": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "startAddress": {
          "type": "string"
        },
        "endAddress": {
          "type": "string"
        },
        "ipVersion": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": [
            "string",
            "null"
          ]
        },
        "parentHandle": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "startAddress",
        "endAddress",
        "ipVersion",
        "name",
        "type",
        "parentHandle",
        "country"
      ]
    },
    "asn": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "start": {
          "type": "integer"
        },
        "end": {
          "type": "integer"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "start",
        "end",
        "name",
        "type",
        "country"
      ]
    },
    "links": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "rel": {
            "type": [
              "string",
              "null"
            ]
          },
          "href": {
            "type": "string"
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "rel",
          "href",
          "type"
        ]
      }
    },
    "raw": {
      "description": "raw=true 时为注册局返回的 RDAP JSON;默认省略"
    }
  },
  "required": [
    "type",
    "query",
    "service",
    "registry",
    "objectClass",
    "handle",
    "name",
    "status",
    "dates",
    "events",
    "entities",
    "nameservers",
    "network",
    "asn",
    "links"
  ]
}
400 请求校验或执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
401 凭据无效、停用、过期或缺少所需 Token

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
403 需要管理员 Token

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
404 请求校验或执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
413 请求体过大

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
415 请求内容类型无效

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
422 请求校验或执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
429 请求过于频繁,Retry-After 为建议等待秒数;匿名额度及认证保护在各 Cloudflare 地点近似计数,Token 业务额度使用 D1 原子计数

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
500 内部执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
502 请求校验或执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}
504 请求校验或执行失败

application/json

{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "issues": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "enum": [
                  "body",
                  "query",
                  "path",
                  "header"
                ]
              },
              "field": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "location",
              "field",
              "code",
              "message"
            ]
          }
        }
      },
      "required": [
        "code",
        "message"
      ]
    }
  },
  "required": [
    "error"
  ]
}

响应示例

运行命令前,将环境变量 BASE_URL 设置为站点地址。

成功响应

curl --silent --show-error -H 'User-Agent: simpleWebUtils-example/1.1.0' -H 'Accept: application/json' "$BASE_URL"'/rdap/asn?asn=15169&raw=false'
HTTP 200
content-type: application/json
content-encoding: gzip
cache-control: public, max-age=300

{
  "type": "asn",
  "query": "15169",
  "service": "13312-15359",
  "registry": "https://rdap.arin.net/registry/",
  "objectClass": "autnum",
  "handle": "AS15169",
  "name": "GOOGLE",
  "status": [
    "active"
  ],
  "dates": {
    "registration": "2000-03-30T00:00:00-05:00",
    "expiration": null,
    "lastChanged": "2012-02-24T09:44:34-05:00",
    "lastUpdateOfRdap": null
  },
  "events": [
    {
      "action": "last changed",
      "date": "2012-02-24T09:44:34-05:00"
    },
    {
      "action": "registration",
      "date": "2000-03-30T00:00:00-05:00"
    }
  ],
  "entities": [
    {
      "handle": "GOGL",
      "roles": [
        "registrant"
      ],
      "name": "Google LLC",
      "kind": "org"
    },
    {
      "handle": "ABUSE5250-ARIN",
      "roles": [
        "abuse"
      ],
      "name": "Abuse",
      "kind": "group"
    },
    {
      "handle": "ZG39-ARIN",
      "roles": [
        "technical",
        "administrative"
      ],
      "name": "Google LLC",
      "kind": "group"
    },
    {
      "handle": "ZG39-ARIN",
      "roles": [
        "technical"
      ],
      "name": "Google LLC",
      "kind": "group"
    }
  ],
  "nameservers": null,
  "network": null,
  "asn": {
    "start": 15169,
    "end": 15169,
    "name": "GOOGLE",
    "type": null,
    "country": null
  },
  "links": [
    {
      "rel": "self",
      "href": "https://rdap.arin.net/registry/autnum/15169",
      "type": "application/rdap+json"
    },
    {
      "rel": "alternate",
      "href": "https://whois.arin.net/rest/asn/AS15169",
      "type": "application/xml"
    }
  ]
}

错误示例

curl --silent --show-error -H 'User-Agent: simpleWebUtils-example/1.1.0' -H 'Accept: application/json' "$BASE_URL"'/rdap/asn?asn=invalid+value&raw=false'
HTTP 400
content-type: application/json
content-encoding: gzip
cache-control: no-store

{
  "error": {
    "code": "INVALID_INPUT",
    "message": "参数无效",
    "issues": [
      {
        "location": "query",
        "field": "asn",
        "code": "invalid_format",
        "message": "格式要求:/^(?:AS|as)?(?:0|[1-9]\\d{0,9})$/"
      }
    ]
  }
}

在线调试

必填
Ctrl / ⌘ + Enter
调用示例
curl -X GET 'https://oit.sh/rdap/asn?asn=15169'

响应

等待请求

等待发送请求

配置上方请求参数后点击「发送请求」查看实时响应

快捷键:Ctrl / ⌘ + Enter