Child pages
  • WHM API 1 Functions - setresolvers
Skip to end of metadata
Go to start of metadata

 

Description

This function configures the server's resolver nameservers.

Warning:

  • The nameservers that the server uses as resolvers must function correctly. If they do not, the server will experience performance and stability issues.
  • Never set a resolver nameserver to 127.0.0.1 on a cPanel & WHM server.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/setresolvers?api.version=1&nameserver1=192.168.0.20&nameserver2=192.168.0.21&nameserver3=2001%3A4860%3A4860%3A%3A8888
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/setresolvers?api.version=1&nameserver1=192.168.0.20&nameserver2=192.168.0.21&nameserver3=2001%3A4860%3A4860%3A%3A8888
 Command Line
whmapi1 setresolvers nameserver1=192.168.0.20 nameserver2=192.168.0.21 nameserver3=2001%3A4860%3A4860%3A%3A3A8888


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": "Your resolvers have been setup!",
    "output": {
      "messages": "Listed in order they are:\n192.168.0.20\n192.168.0.21\n2001:4860:4860::8888"
    },
    "result": 1,
    "command": "setresolvers"
  }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <reason>Your resolvers have been setup!</reason>
        <output>
            <messages>
                Listed in order they are: 192.168.0.20\n192.168.0.21\n2001:4860:4860::8888
            </messages>
        </output>
        <result>1</result>
        <command>setresolvers</command>
    </metadata>
</result>


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample

nameserver1

string

Required

The server's primary resolver nameserver.

  • cPanel & WHM version 11.52 and earlier — A valid IPv4 address.
  • cPanel & WHM version 54 and later — A valid IPv4 or IPv6 address.
192.168.0.20
nameserver2string

Required

The server's secondary resolver nameserver.

  • cPanel & WHM version 11.52 and earlier — A valid IPv4 address.
  • cPanel & WHM version 54 and later — A valid IPv4 or IPv6 address.
192.168.0.21
nameserver3string

The server's tertiary resolver nameserver.

  • cPanel & WHM version 11.52 and earlier — A valid IPv4 address.
  • cPanel & WHM version 54 and later — A valid IPv4 or IPv6 address.
2001:4860:4860::8888

Returns

This function only returns metadata.