Powerdns API

A Nodejs client for the PowerDns API with the most relevant functions.

npm NPM Snyk Vulnerabilities for npm package Website Website

Install

npm i @firstdorsal/powerdns-api

Usage

(async () => {
    //get enviroment variables from the .env file
    require("dotenv").config();
    //import the module
    const { PowerdnsClient } = require("@firstdorsal/powerdns-api");
    //create a powerdns client object
    const pdns = new PowerdnsClient(process.env.PDNS_API_ENDPOINT, process.env.PDNS_API_KEY);
    //use a function and return the results to console
    console.log(await pdns.getZone("example.com"));
})();

What is dotenv?

The line "require('dotenv').config();" gets the contents of a file called ".env" in which you should store your global and secret variables.

1. Install the module "dotenv" with

npm i dotenv

2. Create a file named ".env" in your applications root directory

.env

PDNS_API_KEY='YOUR PDNS API KEY'
PDNS_API_ENDPOINT='https://example.com/api/v1/servers/localhost'

3. Use your secret variables

process.env.PDNS_API_ENDPOINT
process.env.PDNS_API_KEY

IMPORTANT

if you are using domains with two labels for the TLD like yourdomain.com.au please use the setHomogeneousRecords function instead of setRecords

Documentation

Here

Need help or missing a feature?

Feel free to contact me via xl9jthv_7bvgakv9o9wg0jabn2ylm91xxrzzgt0e@y.gy in english or german

Automatic Let's Encrypt certificates via DNS with greenlock and PDNS

acme-dns-01-powerdns

PDNS WEB API Documentation

On the Web

And in full detail (Swagger)

Links

NPM

Documentation

Code