REST-CLI API

REST and CLI API

All the DomDNS software can be drived by REST or by CLI.

REST

You can manage your zones/records from a REST API : curl -X <method> http://YOUR-SERVER/domdns/rest/<class>/<action>

You may need to provide some datas like in PUT/POST methods

Class : servers
    /reload (method GET)
    /export/{zone}/{viewname} (method GET)
Class : records
    /{zone}/{viewname}/importBind (method POST)
    /{zone}/{viewname}/{record} (method GET)
    /{zone}/{viewname}(\?{params})? (method GET)
    /{zone}/{viewname} (method GET)
    /{record} (method PUT)
    /{record} (method DELETE)
    / (method POST)
Class : zones
    / (method GET)
    /{zone} (method GET)
    / (method POST)
    /{zone}/{viewname} (method PUT)
    /{zone}/{viewname} (method DELETE)

CLI

You can manage your zones/records from the CLI (command line interface)

All the primitives are available :

cli/cli.php records <method>

create  
Create a new record
      @param array $datas Datas to be recorded in the new record :
         - string zone The zone name
         - string viewname The viewname
         - source, class, rr, addvalues, target, ttl, comment, opendate,
           closedate
      @return string The last ID inserted

read     [recordname] [display] [order]
Read all the records in the zone/view
      @param string $zone The zone name
      @param string $viewname The view name
      @param string|null $recordname The record ID to see
      @param array|null $display The fields to display
      @param array|null $order The order and direction to sort the entries
      @return An array containing the record(s)

update    
Update a record identified by his key
      @param string $key The record ID to be updated
      @param array $datas : The datas to be updated
         - zoneid, source, class, rr, addvalues, target, ttl, comment, opendate,
           closedate

delete  
Delete a record identified by his key
      @param string $key The record to delete

importBind      
Import the datas into the zone
      The datas are added to the zone. The zone should be cleared before using
      import for a complete and fresh import
      @param string $zone The zone name
      @param string $viewname The view name
      @param string $dataTXT The datas to be imported in Bind format

updateSOA    
Update the SOA timestamp for the zone/view provided
      @param string $zone The zone name
      @param string $viewname The view name

cli/cli.php zones <method>

create  
Create a new zone and the first SOA record
      @param array $datas : The datas to be recorded :
        - string zone The zone name
        - string viewname The view name
        - string viewclients The IPS of clients to be used with this view
        - string comment Comments
        - string opendate The open date
        - string closedate The close date
      @return The last ID created

read [zone] [viewname] [display] [order]
Read all the zones or all the viewnames
      @param string|null $zone The zone name to display (all the zones if null)
      @param string|null $viewname The view to display (all the views if null)
      @param array|null $display The fields to display
      @param array|null $order The order and direction to sort the entries

update      
Update a zone 
      @param string $zone The zone name to update
      @param string $viewname The view name to update
      @param array $datas The datas to be recorded
         - string|null viewclients IP of view clients
         - string|null comment Comments
         - string|null opendate Open date
         - string|null closedate Close date

delete    
Delete a zone
      @param string $zone The zone to delete
      @param string $viewname The view name to delete

cli/cli.php servers <method>

reload
Reload the DNS servers after an update of zones

zoneexport    
Export zone to servers and override existing file
      @param string $zone The zone name
      @param string $viewname The view name