cyandark/powerdns-api

An easy to implement PowerDNS API class, Simple and Lightweight.


Keywords
api, powerdns
License
WTFPL

Documentation

PowerDNS API

StyleCI Codacy

An easy to implement HTTP API for PowerDNS, Simple and Lightweight.

The API only needs PHP 5.4+ and MySQL.

Upload the files to "/var/www/html/api/" and edit the "config.php" with your PowerDNS MySQL Details.

API Documentation

Function Description Parameters
add_domain Add a domain to PowerDNS domain string A valid domain.
solusvm_cid integer (Optional) SolusVM Client ID.
add_record Add a Record to PowerDNS domain_id integer Domain ID.
name string Record Name.
type string Record Type.
content string Record Content.
ttl integer Record TTL.
prio integer Record Priority (Only for MX and SRV).
get_domain_id Get the ID of a Domain domain string A valid domain.
get_domains_by_solusvmid Get domains by SolusVM ID solusvm_cid integer SolusVM Client ID.
get_records_by_domain_id Get the records of a domain domain_id integer Domain ID.
delete_record Delete a Record of PowerDNS record_id integer Record ID.
delete_domain Delete a domain domain_id integer Domain ID.

Using API

All the parameter are sent using GET to the API.

Authentication

http://ns1.yourserver.com/api/?key=Your-API-Key

Response:

{"status":"error","msg":"Action not defined."}

Using Functions

http://ns1.yourserver.com/api/?key=Your-API-Key&action=Action¶m1=xx....

Example

http://ns1.yourserver.com/api/?key=Your-API-Key&action=add_record&domain_id=12&name=demo.com&type=NS&content=google.com

Response:

{"status":"success","msg":"New record created successfully!"}

Installing API

For install the API, only run this command over SSH.

$ cd /var/www/html
$ wget https://github.com/CyanDarkInc/PowerDNS-API/archive/master.zip
$ unzip master.zip
$ mv PowerDNS-API/src api
$ rm -f master.zip

Now you can access to the API from http://Your-PowerDNS-Server-IP/api/