How to use the HTTP API |
Simple DNS Plus v. 5.1 Copyright © 1999-2008 JH Software ApS |
Simple DNS Plus can be prompted to perform different actions through HTTP - either directly from a browser, or any other program that can communicate through HTTP.
This functionality is not intended as a direct user interface, but rather a way to communicate with Simple DNS Plus from other applications over the network (for example, ASP pages running on IIS, PHP pages on Apache, etc.).
By default, Simple DNS Plus listens for HTTP requests on IP address 127.0.0.1 port 8053.
With this default configuration, you can open a web-page that lists the available commands in your browser using http://127.0.0.1:8053
Port 8053 is used to avoid conflicts with any web server software using the standard port 80 on the same machine.
Please note that only the same computer can connect to IP 127.0.0.1, so if you need to access this from another computer, you will need to configure Simple DNS Plus to listen on a different IP address.
You can change these setting in the Options dialog / HTTP API section.
Simple DNS Plus accepts both HTTP "GET" and "POST" requests - use whichever is more convenient for your situation.
When using "GET", all fields and values must be part of the URL.
When using "POST", all fields and values must be in the HTTP request message body.
The response will either be a document (text, XML, or HTML depending on the parameters of the request) containing the result, an error 404 for unrecognized commands, or error 406 for requests that could no be performed.
The request document/path name must be one of the commands described below.
For example, to list the contents of the zone file for example.com, you could use the following (with GET):
http://127.0.0.1:8053/getzone?zone=example.com
Commands:
| • | status Returns server status and request counters. Optionally include the field "format" with the value "text" (the default), "html", or "xml". |
| • | clearcache Clears the DNS cache. Same as selecting "Clear Cache" from the main window / File menu. |
| • | reloadall |
Reloads all zone data from disk.
| • | zonelist |
Returns a list of all zones on the server.
Optionally specify a numeric zone group ID in the field "zonegroup" to limit the list to a single zone group.
Optionally specify the list format in the field "format" (either "xml" or "text").
| • | getzone |
Returns the text of a zone's zone file.
Specify the zone name in the field "zone".
| • | loadzone |
Reloads an existing zone from disk.
Specify the zone name in the field "zone".
NOTE: You don't need to reload zones updated with other HTTP API commands. However this command can be used if the zone file on disk has been updated from another process.
| • | removezone |
Removes an existing zone from the server.
Specify the zone name in the field "zone".
| • | updatehost |
Updates, creates, or deletes an A-record or AAAA-record (host address).
A parent zone must already exist for the host name.
Specify the host name in the field "host".
Specify an IP address (IPv4 or IPv6) in the field "data" (if no data is specified, the record is deleted).
Optionally specify a comment for the host record in the field "comment".
| • | updatezone Updates or creates a new zone on the server. Specify the zone name in the field "zone". Specify the zone data in the field "data" (formatted as a standard zone file). For secondary zones, specify the primary server IP address in the field "masterip". Optionally specify a numeric ID in the field "zonegroup" matching a group ID in the "_zonegroups.xml" file. Make sure to increment the SOA-record serial number when using this command. |
| • | addrecord, updaterecord, removerecord Adds, updates, or removes a DNS record. Specify the zone name in the field "zone". Specify the record name in the field "name" using zone file format (@ = zone name, etc.) Specify the record type in the field "type" (for example: 'A' or 'MX') Specify the record data in the field "data" using zone file format (optional for removerecord) Optionally specify the record TTL in the field "ttl" in seconds. Optionally specify a comment for the record in the field "comment". |
| • | getconfig Returns the Simple DNS Plus configuration (Options dialog settings) in XML format. Note: The format of the configuration XML is not documented and is subject to change from version to version. |
| • | updateconfig Updates the Simple DNS Plus configuration (Options dialog settings). Specify the configuration XML in the field "data". To update individual settings, first use the "getconfig" command to retrieve the current configuration XML, update this, and then submit it back to the server using this command. Note: The format of the configuration XML is not documented and is subject to change from version to version. |
| • | zonegrouplist Returns a list of zone groups on the server (from the DNS Records window). Optionally specify the list format in the field "format" (either "xml" or "text"). |
| • | addzonegroup Adds a new zone group and returns the numeric ID of the new zone group. Specify the name of the new zone group in the field "name". |
| • | renamezonegroup Renames an existing zone group. Specify the numeric ID of the zone group to rename in the field "id". Specify the new zone group name in the field "name". |
| • | removezonegroup Removes a zone group and all zones in it. Specify the numeric ID of the zone group to remove in the field "id". |
| • | aliaszonelist Returns a list of DNS zones sharing the same zone file as the specified zone. Specify the name of the zone to list aliases for in field "zone". Optionally specify the list format in the field "format" (either "xml" or "text"). |
| • | addaliaszone Creates a new primary zone which shares its zone file with another primary zone. Specify the name of the new zone in the field "zone". Specify the name of the existing zone in the field "aliasfor". Optionally specify the numeric zone group ID for the new zone in the field "zonegroup". |
| • | suspendzone, resumezone Suspends or resumes a zones. Specify the name of the zone to suspend/resume in the field "zone". |
| • | zonestatus Returns the current status of a zone (XML format). Specify the name of the zone in the field "zone". |
| • | pluginstate Returns state information about a running plug-in instance (result of SaveState method). The format and content of the returned data depends on the plug-in. Not all plug-ins return state data. Either specify the plug-in instance display name in the field "name" or the instance ID (a GUID) in the field "id". |
| • | getpluginconfig Returns configuration data for a plug-in instance. The format and content of the returned data depends on the plug-in. Either specify the plug-in instance display name in the field "name" or the instance ID (a GUID) in the field "id". |
| • | updatepluginconfig Updates a plug-in instance configuration. The expected format and content of the configuration data depends on the plug-in. Either specify the plug-in instance display name in the field "name" or the instance ID (a GUID) in the field "id". Specify the configuration data in the field "data". |