Command-Line DNS: Utilizing the Porkbun API in Shell Scripts

I believe folks fall into three classes in the case of managing their DNS:Most individuals handle their DNS by way of a web browser: logging into their registrar, supplier, panel, or third-party DNS supplier and utilizing their GUI to alter DNS information.Those that have seven-figure handle their DNS by way of a collection of baroque cloud API calls.And there are is a hardcore who handle their very own DNS, thanks very a lot, and simply soar into their zone information and doubtless use their very own optimized system for managing serial numbers.However what when you’re like me: a man who can’t be bothered to run his personal DNS server as a result of he’s lazy, however when he finds himself within the command-line LowEndZone (ten terminal home windows open, remnants of caffeinated drinks littering the desk, Willie Jones within the headphones), he hates to orthogonally break interface semantics and groan over to a web browser to replace DNS hosted at his registrar?In such a case, you may benefit from the Porkbun API.  Whereas the official examples use Python and Java, it’s simply POSTing JSON and you are able to do that simply with curl as nicely.Getting StartedTo get began with the Porkbun API, you begin by studying the article entitled Getting Began with the Porkbun API.  Sure, it’s all going to be just about this straight-forward.Observe directions to do two issues:Get your API keys.Activate API entry for the area(s) you wish to work with (it’s off by default).Pattern UseHere’s a script that can create an A document referred to as ‘instance.lowend.celebration’, resolving 192.168.1.1.#!/bin/bash

curl –header “Content material-Sort: software/json”
–request POST
–data ‘{
“apikey” : “MY_API_KEY”,
“secretapikey” : “MY_SECRET_KEY”,
“identify” : “instance”,
“kind” : “A”,
“content material” : “1.2.3.4”,
“ttl” : “600”
}’

echoWhen run, it returns:# ./dns.sh
{“standing”:”SUCCESS”,”id”:302181389}And to confirm:# nslookup instance.lowend.celebration 8.8.8.8
Server: 8.8.8.8
Deal with: 8.8.8.8#53

Non-authoritative reply:
Title: instance.lowend.celebration
Deal with: 1.2.3.4

# Full-Featured APIWith the Porkbun API, you are able to do all the essential CRUD operations: create, retrieve, replace, and delete.  Retrieval contains by area, so it’s doable to listing all information for a website.Examine the API docs for all the main points, after which use the above curl script as a template as a result of all you’ll be altering is the JSON you ship and the API endpoint.   Dread Lord of LowEnd Content material at LowEndBoxI’m raindog308, techno polymath and long-time LowEndTalk neighborhood Administrator. My technical pursuits embrace all issues Unix, perl, python, golang, shell scripting, classic working programs reminiscent of MVS, and relational database programs reminiscent of Oracle, PostgreSQL, and MySQL.I additionally get pleasure from utilizing LEBs! I’ve an empire of little guys for VPNs, bigger guys for apps, and massive guys for databases and storage. Once I’m not in entrance a display screen I am into German Shepherd canines, high quality knives, goal taking pictures, theology, tabletop roleplaying video games, and forest mountaineering.I get pleasure from writing technical articles right here on LowEndBox to assist folks get extra out of their programs. You could find me on LowEndTalk @raindog308Latest posts by raindog308 (see all)

🔥 Hot and trending web hostings deals 🔥

HostingsCoupons.com - Web Hostings Coupons, Sales, Deals and Discounts
Logo