We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • UAPI Functions - DNS::has_local_authority
Skip to end of metadata
Go to start of metadata

Description

This function checks whether the local server is authoritative for the domain's DNS records.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/DNS/has_local_authority?domain=example.com&domain=example2.com&domain=example3.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Check if the local server is authoritative for the domain's DNS records.
$poll = $cpanel->uapi(
    'DNS', 'has_local_authority',
    array(
        'domain' => 'example.com',
		'domain' => 'example2.com',
		'domain' => 'example3.com'
  )
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Check if the local server is authoritative for the domain's DNS records.
my $poll = $cpliveapi->uapi(
    'DNS', 'has_local_authority',
    {
        'domain' => 'example.com',
		'domain' => 'example2.com',
		'domain' => 'example3.com'
  }
);


Note:

For more information, read our Guide to the LiveAPI System.

 Command Line
uapi --user=username DNS has_local_authority domain=example.com domain=example2.com domain=example3.com


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
	"apiversion": 3,
	"module": "DNS",
	"func": "has_local_authority",
	"result": {
		"data": [{
				"domain": "example.com",
				"zone": "example.com",
				"nameservers": [
					"ns1.example.com",
					"ns2.example.com"
				],
				"local_authority": 1
			},
			{
				"domain": "example2.com",
				"nameservers": [],
				"local_authority": 0
			},
			{
				"local_authority": 0,
				"domain": "example2.com",
				"nameservers": [],
				"zone": "example3.com",
				"error": "(XID 3z756a) DNS query (example3.com/SOA) timeout!"
			}
		]
	},
	"errors": null,
	"messages": null,
	"metadata": {
		"transformed": 1
	},
	"status": 1,
	"warnings": null
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
domainstring

Required

The domain to check whether the local server is authoritative for the domain's DNS records.

Note:

To check multiple domains, duplicate or increment the parameter name. For example, to check three domains, you could:

  • Use the domain parameter multiple times.
  • Use the domaindomain-1, and domain-2 parameters.
A valid domain.example.com

Returns

ReturnTypeDescriptionPossible valuesExample
dataarray of hashesAn array that contains information about the authoritative status of a domain's local DNS zone files.Each hash contains the domain, zone, nameservers, and local_authority, and error returns.

domain

string

The queried domain.

This function returns this value in the data array.

A valid domain.example.com

zone

string

The domain's DNS zone, if one exists.

This function returns this value in the data array.

  • A valid DNS zone.
  • null — No valid DNS zone.
example.com

nameservers

array of strings

The domain's nameservers, if any exist.

This function returns this value in the data array.

A valid nameserver.ns1.example.com

local_authority

Boolean

Whether the local server is authoritative for the domain's DNS records.

This function returns this value in the data array.

  • 1 — The local server is authoritative for the domain's DNS records.
  • 0 — The local server is not authoritative for the domain's DNS records.
1

error

string

A message that details the reason why the local server's authoritative check failed.

Note:

  • The function only returns this value when the check fails.
  • We added this return in cPanel & WHM version 88.

This function returns this value in the data hash.

An error message.(XID 3z756a) DNS query (example3.com/SOA) timeout!