Book Contents

Previous Topic

Next Topic

Sample Statement. Creating Domain Using XML API (Locally)

To create a sample domain myowntest.domain.com for Client 1 on the basis of Domain template 1, with enabled anonymous FTP, follow these steps:

1. Create an XML packet describing the task, such as the following:

<?xml version="1.0" encoding="UTF-8"?>

<packet version="2.0.1.2">

     <add_use_template>

          <gen_setup>

               <name>myowntest.domain.com</name>

               <client_id>1</client_id>

               <status>0</status>

               <tmpl_id>1</tmpl_id>

          </gen_setup>

          <hosting>

               <vrt_hst>

                    <ftp_login>ftplog</ftp_login>

                    <ftp_password>123123</ftp_password>

               </vrt_hst>

          </hosting>

     </add_use_template>

</packet>

In this packet, specify the following variables:

Note: For the operation to be successful, the domain template must use the Physical hosting hosting type.

2. Save this XML packet in a file - for example, add_domain.xml. The file name format is arbitrary.

3. Direct the file to the standard input (stdin) of the operator exp_plesk_domain used for domain creation.

The query must have the following format:

/usr/local/expand/sbin/exp_plesk_domain <add_domain.xml

Note: exp_plesk_domain is a Plesk Management Operator responsible for domain management operations: creating a new domain, enabling/disabling a domain, setting domain limits, configuring hosting, removing a domain, etc.

For a full list of operators, refer to the Plesk Expand Operators section.

4. The output appears in the shell, in a format similar to the following:

A. Domain was created successfully

     <?xml version="1.0" encoding="UTF-8" standalone="no" ?>

     <packet version="1.2.0.27">

          <add>

               <result>

                    <status>ok</status>

                         <id>8</id>

               </result>

          </add>

B. Domain creation failed

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

<packet version="2.0.1.2">

     <add_use_template>

          <result>

               <status>error</status>

               <errcode>4305</errcode>

               <errtext>[Operator] Quota problem. Domains limit was reached for this server.</errtext>

               <client_id>11</client_id>

               <server_id>2</server_id>

          </result>

     </add_use_template>

</packet>

Error: domains limit was reached for this server.