0

I'm trying to delete a DNS record with Google Cloud DNS REST API. I am able to create one with the following request:

POST https://www.googleapis.com/dns/v1/projects/[PROJECT]/managedZones/[ZONE]/changes
{
  "additions": [
    {
      "name": "[RECORD]",
      "type": "A",
      "ttl": 300,
      "rrdatas": [
        "[IPADRESS]"
      ]
    }
  ]
}

However I cannot figure out how to delete my recently created record using the API. I also can't find a solution in the documentation.

Leonard Niehaus
  • 500
  • 6
  • 16

1 Answers1

1

To delete a DNS Resource Record is almost identical to adding one. You must get the name, type, ttl and rrdatas exactly the same as the existing resource record otherwise the delete will be rejected.

POST https://www.googleapis.com/dns/v1/projects/[PROJECT]/managedZones/[ZONE]/changes
{
  "deletions": [
    {
      "kind": "dns#resourceRecordSet",
      "name": "[RECORD]",
      "type": "A",
      "ttl": 300,
      "rrdatas": [
        "[IPADRESS]"
      ]
    }
  ]
}
John Hanley
  • 74,467
  • 6
  • 95
  • 159