I think people fall into three categories when it comes to managing their DNS:
- Most people manage their DNS via a web browser: logging into their registrar, provider, panel, or third-party DNS provider and using their GUI to change DNS records.
- Those who have seven-figure manage their DNS through a series of baroque cloud API calls.
- And there are is a hardcore who manage their own DNS, thank you very much, and just jump into their zone files and probably use their own optimized system for managing serial numbers.
But what if you’re like me: a guy who can’t be bothered to run his own DNS server because he’s lazy, but when he finds himself in the command-line LowEndZone (ten terminal windows open, remnants of caffeinated beverages littering the desk, Willie Jones in the headphones), he hates to orthogonally break interface semantics and groan over to a web browser to update DNS hosted at his registrar?
In such a case, you might enjoy the Porkbun API. While the official examples use Python and Java, it’s just POSTing JSON and you can do that easily with curl as well.
Getting Started
To get started with the Porkbun API, you start by reading the article entitled Getting Started with the Porkbun API. Yes, it’s all going to be pretty much this straight-forward.
Follow instructions to do two things:
- Get your API keys.
- Turn on API access for the domain(s) you want to work with (it’s off by default).
Sample Use
Here’s a script that will create an A record called ‘example.lowend.party’, resolving 192.168.1.1.
#!/bin/bash curl --header "Content-Type: application/json" \ --request POST \ --data '{ "apikey" : "MY_API_KEY", "secretapikey" : "MY_SECRET_KEY", "name" : "example", "type" : "A", "content" : "1.2.3.4", "ttl" : "600" }' \ https://porkbun.com/api/json/v3/dns/create/lowend.party echo
When run, it returns:
# ./dns.sh {"status":"SUCCESS","id":302181389}
And to verify:
# nslookup example.lowend.party 8.8.8.8 Server: 8.8.8.8 Address: 8.8.8.8#53 Non-authoritative answer: Name: example.lowend.party Address: 1.2.3.4 #
Full-Featured API
With the Porkbun API, you can do all the basic CRUD operations: create, retrieve, update, and delete. Retrieval includes by domain, so it’s possible to list all records for a domain.
Check the API docs for all the details, and then use the above curl script as a template because all you’ll be changing is the JSON you send and the API endpoint.
Related Posts:
- IncogNET Teases Their Takeover of the Privacy-Focused Email Hosting Industry - November 17, 2024
- COMMUNITY NEWS: RackNerd LLC, Global IaaS Provider, Expands European Footprint with New Dublin, Ireland Datacenter - November 16, 2024
- Hey Providers – Want Some FREE Advertising During the SuperBowl? - November 14, 2024
Many thanks. Just what I needed with a few little adjustments. Enjoy your day!