GoDaddy API and PowerShell

I work with our public DNS records quite a bit. The most painful part of the process is navigating through the GoDaddy web portal just to update the same records on a handful of domains. I created a PowerShell module that calls the GoDaddy API, making these simple changes much less frustrating.

I started off doing some research, GoDaddy has wonderful documentation. You’ll need a key/secret pair to make calls to the API, which you can generate here. (Use a production key.)

To make an API call with PowerShell I used Invoke-WebRequest with the following parameters:

  • URI: Specifies the Uniform Resource Identifier (URI) of the Internet resource to which the web request is sent.
  • Method: Specifies the method used for the web request. (Get, Post, Put, etc)
  • Headers: Specifies the headers of the web request. Enter a hash table or dictionary.

To authenticate against the API, I inserted the key/secret into the headers using a hashtable:

Once I was confident that I’d be able to authenticate, I tried using the Get method to retrieve all records for my domain. The API successfully returned the data but in JSON, which wasn’t exactly easy to read:

I reran the command, this time, piping the output to ConvertFrom-Json , resulting in a more legible output:

This is just a glimpse of what you can do with GoDaddy’s API. Make sure to check out the documentation, I’d love to see what you automate!