Child pages
  • WHM API 1 Functions - addzonerecord - Reverse DNS
Skip to end of metadata
Go to start of metadata

Description

This function uses PTR records to add reverse DNS functionality. Reverse DNS lookups use PTR records to convert IP addresses into domain names.

Important:

  • When you call this function, you must include the additional parameters for the selected zone record type. 
  • You must create the zone file before you call this function. For more information, read our How to Configure Reverse DNS for BIND in WHM documentation.

Important:

In cPanel & WHM version 76 and later, when you disable the DNS role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/addzonerecord?api.version=1&zone=0.168.192.in-addr.arpa&name=1&ptrdname=hostname.example.com&type=PTR
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/addzonerecord?api.version=1&zone=0.168.192.in-addr.arpa&name=1&ptrdname=hostname.example.com&type=PTR
 Command Line
whmapi1 addzonerecord zone=0.168.192.in-addr.arpa name=1 ptrdname=hostname.example.com type=PTR 


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "metadata": {
    "version": 1,
    "reason": "Bind reloading on username using rndc zone: [0.168.192.in-addr.arpa]\n",
    "result": 1,
    "command": "addzonerecord"
  }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <reason>
            Bind reloading on username using rndc zone: [0.168.192.in-addr.arpa]
        </reason>
        <result>1</result>
        <command>addzonerecord</command>
    </metadata>
</result>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample

zone

string

Required

The new reverse DNS zone's name.

A valid domain name on the server.0.168.192.in-addr.arpa
namestring

Required

The record's name.

The last octet of the record's IP address.

1
typestring

Required

The DNS record type.

For reverse DNS records, you must select PTR.

PTR
ptrdnamestring

Required

A pointer to a canonical name (CNAME).

A valid hostname.

hostname.example.com

Returns

This function only returns metadata.