其他分享
首页 > 其他分享> > PDNS — REST API 接口

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
                    }
                ]
        }]
}

标签:PDNS,1.1,top,REST,servers,zones,API,myifb,localhost
来源: https://www.cnblogs.com/myifb/p/15949562.html