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

Retrieve a Zone Record — getzonerecord

This function will return zone records for a domain.

To use this function most effectively, you may first wish to run the dumpzone function for the domain(s) whose record(s) you wish to retrieve. The Line output variable from that function call can then be used as a reference to create the input for this function.

Calling Functions

Using the XML API

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

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

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

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

  • 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 getzonerecord function takes the following required variables as input:
  • domain (string) — The domain whose zone record you wish to view.
  • line (string) — The line you wish to view in the zone record.

Output

  • getzonerecord — Root-level XML tag for the output of the getzonerecord function.
    • result — Container for the results of the function.
      • record — Container for the zone record data.
        • name (string) — Domain name. Example: example.com
        • Line (string) — The number of the zone record line retrieved by the function.
        • address (string) — The IP address associated with the zone record.
        • class (string) — The class of the record.
          • note Note: This value is typically IN, for "Internet."
        • raw (string) — Raw line data.
        • ttl (integer) — The record's time to live.
        • type (string) — The DNS record type. Example: NS, SOA, A, etc.
      • status — Result of the function.
        • 1 — success.
        • 0 — failure.
      • statusmsg — Message about the result of the function.

Examples

XML API

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

<getzonerecord>
     <result>
            <record>
                  <name>example.com.</name>
                  <Line>2</Line>
                  <address>127.0.0.1</address>
                  <class>IN</class>
                  <ttl>86400</ttl>
                  <type>A</type>
            </record>
            <status>1</status>
            <statusmsg>Record obtained.</statusmsg>
      </result>
</getzonerecord>

JSON API

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

{
   "result":[
      {
         "status":1,
         "record":{
            "Line":2,
            "address":"127.0.0.1",
            "ttl":86400,
            "class":"IN",
            "type":"A",
            "name":"example.com."
         },
         "statusmsg":"Record obtained."
      }
   ]
}

Topic revision: r5 - 16 Apr 2012 - 15:29:27 - Main.JustinSchaefer