Software Development Kit

cPanel & WHM's API [+] cPanel & WHM's API [-]


Modules and Plugins [+] Modules and Plugins [-]


cPanel & WHM Hooks [+] cPanel & WHM Hooks [-]


cPAddons (Site Software) [+] cPAddons (Site Software) [-]


System Administration [+] System Administration [-]


Developer Software [+] Developer Software [-]


Back to All Documentation

List One Zone — dumpzone

This function displays the DNS zone configuration for a specific domain.

Calling Functions

Using the XML API

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

  • Append the /xml-api/dumpzone 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/dumpzone

  • 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 dumpzone function from within your custom script:

  • Append the /json-api/dumpzone 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/dumpzone

  • 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 dumpzone function takes the following required variable as input:
  • domain (string) — Domain for which to show the DNS zone. Example: example.com

Output

  • dumpzone — Root-level XML tag for the output of the dumpzone function.
    • result — Container for the results of the DNS zone data request.
      • status — Status of the display request.
        • 1 — success.
        • 0 — failure.
      • statusmsg (string) — Information about the status of the request.
      • record (integer) — Representative of a single record in the DNS zone.
        • name (string) — Domain name. Example: example.com
        • Line (string) — Line number in the zone file.
        • Lines (integer) — Number of lines.
          • note Note: This variable only appears if there is more than 1 line.
        • address (string) — IP address. Example: 127.0.0.1
        • class (string) — The class of the record.
          • note Note: This value is typically IN, for "Internet."
        • exchange (string) — In an MX record, the name of the destination mail server.
        • preference (integer) — In an MX record, the priority of the destination mail server.
          • note Note: 0 is the highest priority.
        • expire (string) — A 32-bit time value that specifies the upper limit on the time interval that can elapse before the zone is no longer authoritative.
        • minimum (integer) — The unsigned 32-bit minimum TTL field that should be exported with any record from this zone.
        • mname (string) — The domain name of the name server that was the original or primary source of data for this zone. Example: ns1.example.com
        • nsdname (string) — A domain name which specifies a host which should be authoritative for the specified class and domain. Example: ns1.example.com
        • cname (string) — The "canonical" domain name for which the specified domain is an alias. Example: example.com
        • raw (string) — Raw line output.
        • refresh (integer) — A 32-bit time interval before the zone should be refreshed.
        • retry (integer) — A 32-bit time interval that should elapse before a failed refresh should be retried.
        • rname (string) — A domain name which specifies the mailbox of the person responsible for this zone. Example: user.example.com
          • note Note: The output here is listed as user.example.com rather than user@example.com
        • serial (integer) — The unsigned 32-bit version number of the original copy of the zone.
        • ttl (integer) — The record's time to live.
        • type (string) — The DNS record type. Example: NS, SOA, A, etc.
        • txtdata (string) — Text record data.

Examples

XML API

Calling https://example.com:2087/xml-api/dumpzone?domain=example.com in WebHost Manager will produce output similar to:

<dumpzone>
     <result>
          <status>1</status>
          <statusmsg>Zone Serialized</statusmsg>
          <record>
                <name/>
                 <Line>1</Line>
                 <raw>; cPanel first:11.17.0-BETA_19364 latest:11.23.1-UNKNOWN_24255
                 Cpanel::ZoneFile::VERSION:1.2 mtime:1212701156</raw>
                 <ttl>86400</ttl>
                 <type>:RAW</type>
           </record>
           <record>
                 <name/>
                 <Line>2</Line>
                 <raw>; Zone file for example.com</raw>
                 <ttl>86400</ttl>
                 <type>:RAW</type>
           </record>
           <record>
                 <name/>
                 <Line>3</Line>
                 <ttl>14400</ttl>
                 <type>$TTL</type>
           </record>
           <record>
                 <name>example.com.</name>
                 <Line>4</Line>
                 <Lines>7</Lines>
                 <class>IN</class>
                 <expire>3600000</expire>
                 <minimum>86400</minimum>
                 <mname>ns1.build.cpanel.net</mname>
                 <refresh>86400</refresh>
                 <retry>7200</retry>
                 <rname>webmaster.example.com</rname>
                 <serial>2008060510</serial>
                 <ttl>86400</ttl>
                 <type>SOA</type>
           </record>
           <record>
                 <name>example.com.</name>
                 <Line>11</Line>
                 <class>IN</class>
                 <nsdname>ns1.example.com</nsdname>
                 <ttl>86400</ttl>
                 <type>NS</type>
           </record>
           <record>
                 <name>domain.com.</name>
                 <Line>12</Line>
                 <class>IN</class>
                 <nsdname>ns2.domain.com</nsdname>
                 <ttl>86400</ttl>
                 <type>NS</type>
           </record>
           <record>
                 <name>example.com.</name>
                 <Line>13</Line>
                 <address>10.215.215.13</address>
                 <class>IN</class>
                 <ttl>14400</ttl>
                 <type>A</type>
           </record>
           <record>
                 <name>localhost.example.com.</name>
                 <Line>14</Line>
                 <address>127.0.0.1</address>
                 <class>IN</class>
                 <ttl>14400</ttl>
                 <type>A</type>
           </record>
           <record>
                 <name>example.com.</name>
                 <Line>15</Line>
                 <class>IN</class>
                 <exchange>domain.com</exchange>
                 <preference>0</preference>
                 <ttl>14400</ttl>
                 <type>MX</type>
           </record>
           <record>
                 <name>mail.example.com.</name>
                 <Line>16</Line>
                 <class>IN</class>
                 <cname>domain.com</cname>
                 <ttl>14400</ttl>
                 <type>CNAME</type>
           </record>
           <record>
                 <name>www.example.com.</name>
                 <Line>17</Line>
                 <class>IN</class>
                 <cname>example.com</cname>
                 <ttl>14400</ttl>
                 <type>CNAME</type>
           </record>
           <record>
                 <name>ftp.example.com.</name>
                 <Line>18</Line>
                 <class>IN</class>
                 <cname>example.com</cname>
                 <ttl>14400</ttl>
                 <type>CNAME</type>
          </record>
     </result>
</dumpzone>

JSON API

Calling https://example.com:2087/json-api/dumpzone?domain=example.com in WebHost Manager will produce output similar to:

{
   "result":[
      {
         "status":1,
         "record":[
            {
               "Line":1,
               "raw":"; cPanel first:11.24.7-EDGE_34021 latest:11.24.7-BETA_34513 
Cpanel::ZoneFile::VERSION:1.3 mtime:1239822374 hostname:server.example.com",
               "ttl":"86400",
               "type":":RAW",
               "name":""
            },
            {
               "Line":2,
               "raw":"; Zone file for example.com",
               "ttl":"86400",
               "type":":RAW",
               "name":""
            },
            {
               "Line":3,
               "ttl":"14400",
               "type":"$TTL",
               "name":""
            },
            {
               "serial":"2009041504",
               "minimum":"86400",
               "rname":"admin.example.net",
               "refresh":"86400",
               "Lines":7,
               "name":"example.com.",
               "Line":4,
               "retry":"7200",
               "ttl":"86400",
               "class":"IN",
               "mname":"ns1.example.com",
               "type":"SOA",
               "expire":"3600000"
            },
            {
               "Line":11,
               "raw":"",
               "ttl":"86400",
               "type":":RAW",
               "name":""
            },
            {
               "Line":12,
               "nsdname":"ns1.example.com",
               "ttl":"86400",
               "class":"IN",
               "type":"NS",
               "name":"example.com."
            },
            {
               "Line":13,
               "nsdname":"ns2.example.com",
               "ttl":"86400",
               "class":"IN",
               "type":"NS",
               "name":"example.com."
            },
            {
               "Line":14,
               "nsdname":"ns1.example.com",
               "ttl":"86400",
               "class":"IN",
               "type":"NS",
               "name":"example.com."
            },
            {
               "Line":15,
               "raw":"",
               "ttl":"86400",
               "type":":RAW",
               "name":""
            },
            {
               "Line":16,
               "raw":"",
               "ttl":"86400",
               "type":":RAW",
               "name":""
            },
            {
               "Line":17,
               "ttl":"14400",
               "address":"127.0.0.1",
               "class":"IN",
               "type":"A",
               "name":"example.com."
            },
            {
               "Line":18,
               "raw":"",
               "ttl":"86400",
               "type":":RAW",
               "name":""
            },
            {
               "Line":19,
               "ttl":"14400",
               "address":"127.0.0.1",
               "class":"IN",
               "type":"A",
               "name":"localhost.example.com."
            },
            {
               "Line":20,
               "raw":"",
               "ttl":"86400",
               "type":":RAW",
               "name":""
            },
            {
               "Line":21,
               "ttl":"14400",
               "class":"IN",
               "preference":"0",
               "exchange":"example.com",
               "type":"MX",
               "name":"example.com."
            },
            {
               "Line":22,
               "raw":"",
               "ttl":"86400",
               "type":":RAW",
               "name":""
            },
            {
               "Line":23,
               "cname":"example.com",
               "ttl":"14400",
               "class":"IN",
               "type":"CNAME",
               "name":"mail.example.com."
            },
            {
               "Line":24,
               "cname":"example.com",
               "ttl":"14400",
               "class":"IN",
               "type":"CNAME",
               "name":"www.example.com."
            },
            {
               "Line":25,
               "cname":"example.com",
               "ttl":"14400",
               "class":"IN",
               "type":"CNAME",
               "name":"ftp.example.com."
            },
            {
               "Line":26,
               "ttl":"14400",
               "address":"127.0.0.1",
               "class":"IN",
               "type":"A",
               "name":"server1.example.com."
            },
            {
               "Line":27,
               "ttl":"14400",
               "address":"127.0.0.1",
               "class":"IN",
               "type":"A",
               "name":"ns2.example.com."
            },
            {
               "Line":28,
               "ttl":"14400",
               "address":"127.0.0.1",
               "class":"IN",
               "type":"A",
               "name":"ns1.example.com."
            }
         ],
         "statusmsg":"Zone Serialized"
      }
   ]
}

Topic revision: r6 - 05 Apr 2010 - 14:00:10 - MelanieSeibert