To add a new host to the ACL of your name server, use the add_to_acl operation. You can add multiple hosts to ACL using a single packet. This operation is available on Linux only.

Request Packet Structure

A request XML packet adding a new host to the ACL includes the add_to_acl operation node:

<packet>
    <dns>
        <add_to_acl>
            ...
        </add_to_acl>
    </dns>
</packet>

The graphical representation of the add_to_acl node is as follows:

image 34908

Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.9.1/agent_input.svg.

  • The filter node is required. It specifies the filtering rule. For more information, refer to the Available Filters section. Data type: aclFilter (dns_input.xsd) .

You can add multiple hosts to the ACL in a single packet using filters. Add as many host parameters to the filter node as the number of hosts you want to add to the ACL.

Response Packet Structure

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

image 34912

Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.9.1/agent_output.svg.

  • The result node is optional. It is required in case when an error (if it occurred) was not of a system type. Data type: aclresultType (common.xsd).
  • The status node is required. It specifies the execution status of the get_acl operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. It is used to return the error code when the get_acl operation fails. Data type: unsignedInt.
  • The errtext node is optional. It is used to return the error message if the get_acl operation fails. Data type: string.
  • The host node is optional. It is required in case when an error (if it occurred) was not of a common type. Returns the IP address or name of hosts from the ACL. Data type: string.

Samples

Adding a single host to ACL

This request packet adds host 192.168.34.56 to the ACL.

<packet>
    <dns>
        <add_to_acl>
            <filter>
                <host>192.168.34.56</host>
            </filter>
        </add_to_acl>
    </dns>
</packet>

Response:

<packet>
    <dns>
        <add_to_acl>
            <result>
                <status>ok</status>
                <host>192.168.34.56</host>
            </result>
        </add_to_acl>
    </dns>
</packet>

Adding a host to ACL twice

This request packet adds host 192.168.34.56 to the ACL two times.

<packet>
    <dns>
        <add_to_acl>
            <filter>
                <host>192.168.34.56</host>
            </filter>
        </add_to_acl>
        <add_to_acl>
            <filter>
                <host>192.168.34.56</host>
            </filter>
        </add_to_acl>
    </dns>
</packet>

Response:

<packet>
    <dns>
        <add_to_acl>
            <result>
                <status>ok</status>
                <host>192.168.34.56</host>
            </result>
        </add_to_acl>
        <add_to_acl>
            <result>
                <status>error</status>
                <errcode>1007</errcode>
                <errtext>IP address 192.168.34.56 already exists.</errtext>
            </result>
        </add_to_acl>
    </dns>
</packet>