The NameCheap project builds a command line interface (CLI) application that can add and remove text records using the NameCheap API.
It was originally built to allow for creating wildcard TLS certificates using win-acme (Let's Encrypt) on an IIS server. Creating wildcard certificates with win-acme requires DNS host validation. This application can be used with the win-acme script feature to allow it to communicate with the NameCheap API and create/delete TXT records that will validate domain ownership.
This tool does not support the complete NameCheap API. But it does handle the challenging task of adding and removing text records. Why is this challenging? The NameCheap API does not have functions to add or remove individual records, so the entire set of records must be downloaded, modified, and sent back.
Download the project and publish it from the root project folder as below.
In the publish folder, edit the appsettings.json file and supply your own values.
Once the appsettings.json file is modified, put the contents of the publish folder on your server and you should be able to use the executable with win-acme or any other tool by calling it with a fully qualified path.
The command line is in the format below:
Some examples include:
So in win-acme you would set your create script arguments to this:
Likewise, your delete script arguments would be:
The tool can be used on Linux or macOS as well. If the published executable doesn't run on macOS you may need to manually sign the published application using something like this:
There's usually more to the story so if you have questions or comments about this post let us know!
Do you need a new software development partner for an upcoming project? We would love to work with you! From websites and mobile apps to cloud services and custom software, we can help!