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

Add Reverse DNS Zone Record — addzonerecord

The addzonerecord function allows you to add reverse DNS functionality using PTR records. PTR records are used in reverse DNS lookups that convert IP addresses into domain names.

Calling Functions

Using the XML API

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

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

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

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

  • 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

In order to add a reverse PTR entry, you must first create the reverse DNS zone file.

Adding a PTR record using the addzonerecord call requires 4 input parameters:

  • zone — The name of the reverse DNS zone file to create. This value must follow a standardized naming schema.
  • name — You will need to enter the last octet of the IP address here. If your IP address was 192.168.0.1, you would enter 1 in this parameter.
  • ptrdname — The name of the domain to which the IP address will resolve (e.g. example.com).
  • type — You should set this parameter to PTR.

Output

  • addzonerecord — Root-level XML tag for the output of the addzonerecord function.
    • result — Container for the results of the function.
      • status (boolean) — Status of the request.
        • 1 — true.
        • 0 — false.
      • statusmsg (string) — Additional information from the server about the addition of the DNS zone.

Examples

XML API (for IPv4 addresses)

Calling https://www.example.com:2087/xml-api/addzonerecord?zone=0.168.192.in-addr.arpa&name=1&ptrdname=example.com&type=PTR would create the following line in /var/named/0.168.192.in-addr.apra:

1    14400        PTR    example.com.

The output should resemble the following using XML API:

<addzonerecord>
   <result>
      <status>1</status>
      <statusmsg>Bind reloading on server1 using rndc zone: [0.168.192.in-addr.arpa]</statusmsg>
   </result>
</addzonerecord>

JSON API (for IPv4 addresses)

Calling https://www.example.com:2087/json-api/addzonerecord?zone=0.168.192.in-addr.arpa&name=1&ptrdname=example.com&type=PTR would create the following line in /var/named/0.168.192.in-addr.apra:

1    14400        PTR    example.com.

The output should resemble the following using JSON API:

{
   "result":[
      {
         "status":1,
         "statusmsg":"Bind reloading on server1 using rndc zone: [0.168.192.in-addr.arpa]\n"
      }
   ]
}

XML API (for IPv6 addresses)

Calling https://www.example.com:2087/xml-api/addzonerecord?zone=2.0.0.0.0.0.0.2.d.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.ip6.arpa&name=6.2&ptrdname=example.com&type=PTR would create the following line in /var/named/2.0.0.0.0.0.0.2.d.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.ip6.arpa :

6.2    14400        PTR    example.com.

The output should resemble the following using XML API:

<addzonerecord>
   <result>
      <status>1</status>
      <statusmsg>Bind reloading on server1 using rndc zone: [2.0.0.0.0.0.0.2.d.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.ip6.arpa]</statusmsg>
   </result>
</addzonerecord>

JSON API (for IPv6 addresses)

Calling https://www.example.com:2087/json-api/addzonerecord?zone=2.0.0.0.0.0.0.2.d.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.ip6.arpa&name=6.2&ptrdname=example.com&type=PTR would create the following line in /var/named/2.0.0.0.0.0.0.2.d.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.ip6.arpa :

6.2    14400        PTR    example.com.

The output should resemble the following using JSON API:

{
   "result":[
      {
         "status":1,
         "statusmsg":"Bind reloading on server1 using rndc zone: [2.0.0.0.0.0.0.2.d.0.0.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.ip6.arpa]\n"
      }
   ]
}
Topic revision: r8 - 23 Jan 2012 - 20:14:17 - Main.JustinSchaefer
AllDocumentation/AutomationIntegration.XmlApiAddZoneRecordAddition moved from Sandbox.XmlApiAddZoneRecordAddition on 23 Sep 2010 - 17:02 by Main.JustinSchaefer