Not Getting Custom Nameservers Using Godaddy Api

1.5k views Asked by At

I used this api call to get DNS records and nameservers using domain name https://api.godaddy.com/v1/domains/testsd34.com/records/NS

GetRecords here is the api call

For default godaddy nameservers its giving everything perfectly but whenever i am using custom nameservers for domain that time this api call not giving nameservers in response its giving empty array, anyone knows how to get custom nameservers using this api call?

1

There are 1 answers

0
foxtrot9 On

Finally, I found a way to get and edit nameservers for domain. (For custom nameservers, records are not set by GoDaddy, therefore you have to query nameserver provider.)

Following is the API call for getting nameservers:

HTTP request:
GET https://api.godaddy.com/api/v1/domains/mydomain.com
HTTP headers:
Authorization -> sso-key my-key:my-secret
Content-Type  -> application/json

Response will contain JSON object which has key "nameservers" with pair of nameservers that you have. Example:

"nameServers": [
    "ns1.mynameservers.com",
    "ns2.mynameservers.com"
]

To edit the nameservers via API call, you can use following API call:

HTTP request:
PATCH https://api.godaddy.com/api/v1/domains/mydomain.com
HTTP headers:
Authorization -> sso-key my-key:my-secret
Content-Type  -> application/json
HTTP body:
{
  "nameServers": [
     "ns3.mynameservers.com",
     "ns4.mynameservers.com"
  ]
}