Update server's resolver nameservers

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.
SecurityBasicAuth
Request
query Parameters
required
string or string

The server's primary resolver nameserver.

Example: nameserver1=192.168.0.20
required
string or string <ipv4>

The server's secondary resolver nameserver.

Example: nameserver2=192.168.0.21
string or string
Default: ""

The server's tertiary resolver nameserver.

Example: nameserver3=2001:4860:4860::8888
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
get/setresolvers
Request samples
whmapi1 --output=jsonpretty \
  setresolvers \
  nameserver1='192.168.0.20' \
  nameserver2='192.168.0.21'
Response samples
application/json
{
  • "metadata": {
    • "command": "setresolvers",
    • "output": {
      • "messages": "Listed in order they are:\n192.168.0.20\n192.168.0.21\n2001:4860:4860::8888\n"
      },
    • "reason": "Your resolvers have been setup!",
    • "result": 1,
    • "version": 1
    }
}