Use Custom Script Help


#1

Does anybody have examples of the custom scripts? I’m having a hard time figuring out how does this program communicate with the DNS service API… If anybody has a .bat script they’re willing to share I would love to see it.

Thanks, Taylor


#2

Which DNS provider are you trying to talk to?

Note that the latest beta (4.1.0-beta2) has support for acme-dns CNAME redirection (e.g. no DNS API required) and beta support for Microsoft DNS.


#3

https://www.dynu.com/


#5

Okay, now I have a better understanding of how the .bat file works.
But are there any examples of the .ps1 file?
As you can tell I’m very new to scripting…


#6

https://www.powershellgallery.com/packages/Posh-ACME/2.7.0/Content/DnsPlugins\Dynu.ps1

I can’t speak to the validity of it, but this appears to be what you are looking for more or less. The API for your provider is based on making web requests.

Add-DnsTxtDynu would let you add records in the add script. Remove-DnsTxtDynu will let you remove them after. You will need an API key from Dynu to make use of it.


#7

Thank you for that URL it is helping me build this Powershell script.

However I am having trouble getting the API key authentication working.

This is what I have so far.

Invoke-RestMethod -Method GET -Uri ‘https://api.dynu.com/v2/DNS’ -ContentType ‘application/json’ -Headers @{ “X-Api-Key” = ‘The API key goes here’}

I still receive a 401 authentication error.


#8

Does your script actually say “The API key goes here” or did you put your API key there? You need to get an API key from dynu and replace ‘The API key goes here’ with that key.


#9

No I went on to Dynu found the API key and plug it in. I didn’t want to publicly show my API key.


#10

According to their docs the auth header is ‘API-Key’ (without the ‘X-’): https://www.dynu.com/Support/API


#11

That worked!!
Thanks!!