Retrieving Primary Name Servers
Use the get_master_server operation to retrieve IP addresses of the primary name servers for the specified zone. You can retrieve multiple primary servers in a single packet.
Request Packet Structure
A request XML packet retrieving a primary name server includes the get_master_server operation node:
<packet version="1.6.7.0">
<dns>
<get_master_server>
...
</get_master_server>
</dns>
</packet>
The graphical representation of the get_master_server node is as follows:
Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.
- The filter node is required. It specifies the filtering rule.
For more information, refer to the Available Filters
section. Data type: dnsSelectionFilterType (
dns_input.xsd
) .
Note: If the filter node is left blank (<filter/>
), the operation
will retrieve all primary name servers available for a packet sender
on the server.
You can retrieve multiple primary name servers in a single packet. Add as many get_master_server operations as the number of different filtering rules you use.
<dns>
<get_master_server>
...
</get_master_server>
...
<get_master_server>
...
</get_master_server>
</dns>
Response Packet Structure
The get_master_server node of the output XML packet is structured as follows:
Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.
- The result node is required. It wraps the response from the
server. Data type: resultFilterType (
common.xsd
). - The status node is required. It specifies the execution status of the get_master_server operation. Data type: string. Allowed values: ok | error.
- The errcode node is optional. It is used to return the error code when the get_master_server operation fails. Data type: unsignedInt
- The errtext node is optional. It is used to return the error message if the get_master_server operation fails. Data type: string.
- The id node is optional. It is required if the operation get_master_server has succeeded. Returns the ID of the primary name server in Plesk database. Data type: integer.
- The filter-id node is optional. It holds the filtering rule parameter. For info on filters, refer to the Available Filters section. Data type: integer.
- The site-id node is required. Specifies the ID of the site, which zone will be served by the primary name server. Data type: integer.
- The site-alias-id node is required. Specifies the ID of the site alias, which zone will be served by the primary name server. Data type: integer.
- The ip_address node is required. Specifies the IP address of a primary name server. Data type: integer.
Samples
Retrieving a single name server
This packet retrieves the IP address of the primary name server with ID 5.
<packet>
<dns>
<get_master_server>
<filter><id>5</id></filter>
</get_master_server>
</dns>
</packet>
Response:
<packet>
<dns>
<get_master_server>
<result>
<status>ok</status>
<filter-id>5</filter-id>
<id>5</id>
<site-id>1</site-id>
<ip_address>115.16.17.18</ip_address>
</result>
</get_master_server>
</dns>
</packet>
If the name server specified by the ID was not found, the response can look as follows:
<packet>
<dns>
<get_master_server>
<result>
<status>error</status>
<errcode>1013</errcode>
<errtext>Master server is not found. ID : 5</errtext>
</result>
</get_master_server>
</dns>
</packet>
If the site specified by the ID was not found, the response can look as follows:
<packet>
<dns>
<get_master_server>
<result>
<status>error</status>
<errcode>1015</errcode>
<errtext>site does not exist.</errtext>
</result>
</get_master_server>
</dns>
</packet>
Retrieving multiple name servers
This packet retrieves primary name servers for the zones specified by site ID 5 and ID 6, and site alias ID 16.
<packet>
<dns>
<get_master_server>
<filter>
<site-id>5</site-id>
<site-id>6</site-id>
</filter>
</get_master_server>
<get_master_server>
<filter>
<site-alias-id>16</site-alias-id>
</filter>
</get_master_server>
</dns>
</packet>
Response (when two primary servers on site with ID 5, one on the site with ID 6 are found; the site alias with ID 16 was not found):
<packet>
<dns>
<get_master_server>
<result>
<status>ok</status>
<filter-id>5</filter-id>
<id>15</id>
<site-id>5</site-id>
<ip_address>15.16.17.18</ip_address>
</result>
<result>
<status>ok</status>
<filter-id>5</filter-id>
<id>16</id>
<site-id>5</site-id>
<ip_address>11.16.17.18</ip_address>
</result>
<result>
<status>ok</status>
<filter-id>6</filter-id>
<id>28</id>
<site-id>6</site-id>
<ip_address>10.6.17.18</ip_address>
</result>
</get_master_server>
<get_master_server>
<result>
<status>error</status>
<errcode>1015</errcode>
<errtext>site alias does not exist.</errtext>
</result>
</get_master_server>
</dns>
</packet>