本系统提供了简单易用的API接口,方便开发者集成IP黑白名单查询功能。
获取系统中所有的IP记录信息。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 固定值:get_all |
curl "http://example.com/api.php?action=get_all"
{"code":200,"message":"获取成功","data":[{"id":1,"ip":"192.168.1.0/24","location":"本地网络","isp":"","remark":"内部网络"},{"id":2,"ip":"10.0.0.1","location":"本地网络","isp":"","remark":"网关"}]}
根据关键词搜索IP记录,可以搜索IP地址、网段、地区或备注信息。
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| action | string | 是 | 固定值:search |
| keyword | string | 是 | 搜索关键词 |
curl "http://example.com/api.php?action=search&keyword=192.168"
{"code":200,"message":"搜索成功","data":[{"id":1,"ip":"192.168.1.0/24","location":"本地网络","isp":"","remark":"内部网络"}]}
不提供任何参数时,默认返回所有IP记录。
curl "http://example.com/api.php"
{"code":200,"message":"获取成功","data":[{"id":1,"ip":"192.168.1.0/24","location":"本地网络","isp":"","remark":"内部网络"}]}
所有API接口都返回JSON格式的数据,包含以下字段:
| 状态码 | 描述 |
|---|---|
| 200 | 请求成功 |
| 400 | 无效的请求操作 |
| 403 | 禁止修改操作 |