I'm making the following API call to PowerDNS, expecting to replace the old record value oldhostname.example.net
with the new value newhostname.example.net
.
PATCH /api/v1/servers/localhost/zones/example.org
X-API-Key: secret
Content-Type: application/json
{
"rrsets": [
{
"name": "test.example.org.",
"type": "CNAME",
"ttl": 3600,
"changetype": "REPLACE",
"records": [
{
"content": "newhostname.example.net.",
"disabled": false
}
]
}
]
}
The result is 400 error from the API with the messsage "The CNAME record you are trying to create already exists."
I know the record test.example.org
already exists, my intent was to replace it with the new content.
Making two separate calls, one to delete and another to add, works. But I want to avoid any momentary NXDOMAIN responses to queries between the 2 API calls which could be negative cached on other DNS forwarders in the environment and cause a longer than necessary outage.
If "changetype": "REPLACE"
does not actually replace the record, then what is the correct way to update a record in this API?