powerdns

Inserting A records using the PowerDNS REST api


I have an issue with the web interface. I'm using powerdns v3.4.5 with mysql as the back-end. I have followed instructions from here: https://www.unixmen.com/how-to-install-powerdns-on-ubuntu-14-04/

I have successfully installed powerdns with mysql and got the web-api to work. However I have trouble inserting A records using the REST api. I have followed command from here: https://doc.powerdns.com/md/httpapi/README/

This creates a new zone:

curl -X POST --data '{"name":"example.org.", "kind": "Native", "masters": [], "nameservers": ["ns1.example.org.", "ns2.example.org."]}' -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/servers/localhost/zones | jq .

(note that I changed the url and removed /api/v1/)

However when I run the following command to add a new A record:

curl -X PATCH --data '{"rrsets": [ {"name": "test.example.org.", "type": "A", "ttl": 86400, "changetype": "REPLACE", "records": [ {"content": "192.0.5.4", "disabled": false } ] } ] }' -H 'X-API-Key: changeme' http://127.0.0.1:8081/servers/localhost/zones/example.org. | jq .

I get the following error:

"error": "RRset test.example.org. IN A: Name is out of zone"

is there anything that I'm missing?


Solution

  • It should be as follows:

    curl -X POST --data '{"name":"example.org", "kind": "Master","dnssec":false,"soa-edit":"INCEPTION-INCREMENT","masters": [], "nameservers": ["ns1.example.org"]}' -v -H 'X-API-Key: changeme' http://127.0.0.1:8081/servers/localhost/zones | jq .
    

    and then:

    curl -X PATCH --data '{"rrsets": [ {"name": "test.example.org", "type": "A", "changetype": "REPLACE", "records": [ {"content": "192.168.9.9", "disabled": false, "name": "test.example.org", "ttl": 86400, "type": "A", "priority": 0 } ] } ] }' -H 'X-API-Key: changeme' http://127.0.0.1:8081/servers/localhost/zones/example.org | jq .