REST API - notihnio/PowerDNS-API GitHub Wiki

REST API

The whole point of this is to have an HTTP API for the PowerDNS database, so we'll strive for having it "REST-like". This will also play well with backbone.js if we ever make a HTML/JS UI for it.

See the Authentication page for information on how to authenticate to the API.

Data calls

Create a domain

PUT /api/domain/example.com

Parameters:

  • type - MASTER or SLAVE
  • master - IP address of master server (if type is SLAVE)

Also the following parameters will be set in the SOA record if set, otherwise some reasonable default will be used: primary, hostmaster, serial, refresh, retry, expire, default_ttl.

Get list of domains

GET /api/domain/

Get information on a domain

GET /api/domain/example.com

This will include the actual records (including a numeric ID from the database), use options to filter, for example:

Only get the SOA record: GET /api/domain/example.com?type=SOA

Only get A records: GET /api/domain/example.com?type=A

Only get records with the name 'foo': GET /api/domain/example.com?name=foo

Settings:

  • type (master or slave)
  • master (IP of master if type is slave)

TODO:

  • soa parameters

Update a domain

POST /api/domain/example.com?some=parameter

Will fail if example.com doesn't exist. Parameters taken are the same as for PUT domain.

Delete a domain

DELETE /api/domain/123

also deletes domain records

Create a new record

POST /api/record/example.com?type=A&name=www&content=10.0.0.2

Will always create a new record, even if there already is a 'www.example.com' A record.

Update a record

PUT /api/record/example.com/123?name=www&type=A&data=10.0.0.1&ttl=86400

This will update the parameters specified and leave others as they were. (Probably this should really be POST, too...)

Delete a record

DELETE /api/record/example.com/123

Future plans

  • Support JSONP

  • Should the parameters be sent via a JSON object instead of plain HTTP query parameters? Other than maybe future bulk edits, I can't think of any data where this would make things simpler.