PDNS — REST API 接口

注:头部参数: x-api-key: {$api_key} //pdns配置文件中自定义此参数值

1.查看区域

GET /servers/localhost/zones

2.添加区域

POST /servers/localhost/zones
参数
{
"name":"myifb.top.",
"kind":"Natice",
}

3.查看解析记录

GET servers/localhost/zones/myifb.top

4.添加解析记录(A)

PATCH servers/localhost/zones/myifb.top

{
        "rrsets": [{
                "name": ".myifb.top.",
                "type": "A",// A|CNAME|LUA
                "ttl": 600,
                "changetype": "replace",
                "records": [
                   {
                     "content": "1.1.1.1",
                     "disabled": false
                    }
                ]
        }]
}

4.添加解析记录(LUA)

PATCH servers/localhost/zones/myifb.top

使用GeoIP获取ip请求国家,返回对应的解析记录

{
        "rrsets": [{
                "name": "lua.myifb.top.",
                "type": "LUA",
                "ttl": 86400,
                "changetype": "replace",
                "records": [
                   {
                     "content": "A \";if(country('HK')) then return '1.1.1.1' elseif(country('CN')) then return '2.2.2.2'  elseif(country('JP')) then return '3.3.3.3' else return '99.99.99.99' end\"",
                     "disabled": false
                    }
                ]
        }]
}
上一篇:Redis系列(二):Redis的5种数据结构及其常用命令


下一篇:redis入门