GoDaddy Deleting a single DNS record through the API using Bash/Shell script

Viewed 783
1 Answers

EDIT The original answer seems to be obsolete

GoDaddy has added the respective endpoint to delete a single entry. So now you can do

DELETE /v1/domains/{domain}/records/A/{name}

Original answer

Unfortunately, godaddy's api does not provide the endpoint for deleting a single domain record in a single call. So you will have to

  1. GET /v1/domains/{domain}/records/A to fetch all A-records for the domain first (https://developer.godaddy.com/doc/endpoint/domains#/v1/recordGet)
  2. remove the record to delete from the resulting list
  3. PUT /v1/domains/{domain}/records/A the modified recordset to replace all A-records for the domain with the given list of records (https://developer.godaddy.com/doc/endpoint/domains#/)

As the API endpoints return/expect JSON data, you might need some additional tool to manipulate the json data. You might find something in this answer Parsing JSON with Unix tools

You might be tempted to use PUT /v1/domains/{domain}/records/A/{recordname} to replace all A-records with the given name with the provided list of records (https://developer.godaddy.com/doc/endpoint/domains#/v1/recordReplaceTypeName) using an empty list of records in the body. The last time I tried that, it didn't work.

Related