Adding Primary Name Server

Use the add_master_server operation to add a primary name server. This server will be primary for the zone specified by the site ID or site alias ID. You can add multiple primary servers in a single packet.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 
Request Packet Structure

A request XML packet adding a primary name server includes the add_master_server operation node:

<packet>
<dns>
   <add_master_server>
   ...
   </add_master_server>
</dns>
</packet>

 

The graphical representation of the add_master_server node is as follows:

  • 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.

You can add multiple primary name servers in a single packet. Add as many add_master_server operations as the number of different servers you want to add.

<dns>
   <add_master_server>
   ...
   </add_master_server>
...
   <add_master_server>
   ...
   </add_master_server>
</dns>

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 
Response Packet Structure

The add_master_server node of the output XML packet is structured as follows:

  • The result node is required. It wraps the response from the server. Data type: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the add_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 add_master_server operation fails. Data type: unsignedInt.
  • The errtext node is optional. It is used to return the error message if the add_master_server operation fails. Data type: string.
  • The id node is optional. It is required if the operation add_master_server has succeeded. Returns the ID of the primary name server in Plesk database. Data type: integer.
 
Samples
Adding a single primary name server

This request packet adds a primary name server to the zone of the site with ID 5.

<packet>
<dns>
 <add_master_server>
  <site-id>5</site-id>
  <ip_address>10.6.45.18</ip_address>
 </add_master_server>
</dns>
</packet>

Response:

<packet>
<dns>
 <add_master_server>
  <result>
   <status>ok</status>
   <id>4</id>
  </result>
 </add_master_server>
</dns>
</packet> <code> </code>

 

If the IP address parameter has invalid format, the response looks as follows:

<packet>
<dns>
 <add_master_server>
  <result>
   <status>error</status>
   <errcode>1014</errcode>
   <errtext>Parser error: Cannot parse the XML from the source specified</errtext>
   <id>4</id>
  </result>
 </add_master_server>
</dns>
</packet>

 

If the site specified by the ID was not found on the server, the response looks as follows:

<packet>
<dns>
 <add_master_server>
  <result>
   <status>error</status>
   <errcode>1015</errcode>
   <errtext>site does not exist.</errtext>
   <id>4</id>
  </result>
 </add_master_server>
</dns>
</packet>
Adding multiple primary name servers

This request packet adds a primary name server to the zone of the site with ID 5 and ID 7.

<packet>
<dns>
 <add_master_server>
  <site-id>5</site-id>
  <ip_address>10.6.45.18</ip_address>
 </add_master_server>
 <add_master_server>
  <site-id>7</site-id>
  <ip_address>10.6.45.18</ip_address>
 </add_master_server>
</dns>
</packet>

Response:

<packet>
<dns>
 <add_master_server>
  <result>
   <status>ok</status>
   <id>4</id>
  </result>
 </add_master_server>
 <add_master_server>
  <result>
   <status>ok</status>
   <id>5</id>
  </result>
 </add_master_server>
</dns>
</packet>