2

I'd like to delete a single DNS record (an A record) through the API via CURL or any other Shell/Bash command.

I also tried to access GoDaddy's website but unfortunately it no longer exists and returns 404.

https://www.godaddy.com/community/Managing-Domains/Deleting-a-single-DNS-record-through-the-API/td-p/108003

Is it possible, how can I do that?

James
  • 875
  • 2
  • 15
  • 24

1 Answers1

5

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.

derpirscher
  • 14,418
  • 3
  • 18
  • 35
  • This will only work if there is more records of that type, otherwise it will try to update with an empty array and do nothing, as explained in the end of the answer. – Lucas Basquerotto Nov 09 '20 at 23:59