Page tree
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?nameserver1=192.168.0.20&nameserver2=192.168.0.21
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/setresolvers?nameserver1=192.168.0.20&nameserver2=192.168.0.21
 Command Line
whmapi0 setresolvers nameserver1=192.168.0.20 nameserver2=192.168.0.21

Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 0 documentation or run the whmapi0 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
   "setresolvers":[
      {
         "status":1,
         "statusmsg":"Your resolvers have been setup!",
         "msgs":[
            "Listed in order they are:",
            "192.168.0.20",
            "192.168.0.21",
         ],
         "warns":null
      }
   ]
}
 Output (XML)
<setresolvers>
     <setresolvers>
            <msgs>Listed in order they are:</msgs>
             <msgs>192.168.0.20</msgs>
             <msgs>192.168.0.21</msgs>
             <status>1</status>
             <statusmsg>Your resolvers have been setup!</statusmsg>
             <warns/>
     </setresolvers>
</setresolvers>

   

Parameters

ParameterTypeDescriptionPossible valuesExample

nameserver1

string

Required

The server's primary resolver nameserver.

A valid nameserver.ns1.example.com
nameserver2stringThe server's secondary resolver nameserver.A valid nameserver.ns2.example.com
nameserver3stringThe server's tertiary resolver nameserver.A valid nameserver.ns3.example.com

 

Returns

ReturnTypeDescriptionPossible valuesExample
setresolvershashA hash of function information.This hash contains the status, statusmsg, msgs, and warns parameters. 

status

booleanWhether the function succeeded.
  • 1 — Success.
  • 0 — Failure.
1

statusmsg

stringA message of success, or a reason for failure.
  • A success message.
  • An error message.
Your resolvers have been setup!

msgs

arrayAn array of nameserver IP addresses.An array that contains a header string and one or more IP addresses.
"Listed in order they are:", "192.168.0.20", "192.168.0.21",

warns

stringAny warning messages.One or more warning messages.null