Add a DNS Zone — adddns

This function creates a DNS zone. All zone information other than domain name and IP address is created based on the standard zone template in WHM. (To edit that template, go to: https://YOURIP:2087/scripts2/editzonetemplate?template=standard) Your MX, nameserver, domain PTR, and A records will all be generated automatically.

Calling Functions

Using the XML API

To use the XML API to perform the adddns function from within your custom script:

  • Append the /xml-api/adddns function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/xml-api/adddns

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Using the JSON API

To use the JSON API to perform the adddns function from within your custom script:

  • Append the /json-api/adddns function call name, plus the required variables (see below), to a URL which includes the address of your server.

  • For example, on a server whose hostname is example.com, you would include the following string in your script: https://example.com:2087/json-api/adddns

  • You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script.

  • You can also perform the function by entering the string in your web browser's address bar. This may be useful for testing the function call and viewing its output.

Variables

Input

The adddns function takes the following required variables as input:

  • domain (string) — Domain name for the zone that will be added.
  • ip (string) — IP address associated with the domain name.

Output

  • adddns — Root-level XML tag for the output of the adddns function.
    • result — Container for the results of the DNS zone addition.
      • status (boolean) — Status of the deletion request.
        • 1 — success.
        • 0 — failure.
      • statusmsg (string) — Information about the status of the request.

Examples

XML API

Calling https:example.com:2087/xml-api/adddns?domain=example.com&ip=1.2.3.4 in WebHost Manager will produce results similar to:

<adddns>
     <result>
          <status>1</status>
          <statusmsg>Added example.com ok</statusmsg>
   </result>
</adddns>

JSON API

Calling https:example.com:2087/json-api/adddns?domain=example.com&ip=1.2.3.4 in WebHost Manager will produce results similar to:

{
   "result":[
      {
         "status":1,
         "statusmsg":"Added example.com ok"
      }
   ]
}

Topic revision: r6 - 29 Sep 2009 - 17:42:32 - Main.MelanieSeibert
 

Copyright © cPanel 2000-2009.