A packet can be represented graphically in the following way:

image 68438

  1. HTTP header - a transport part. In addition to other standard information, it must contain information about the server where the operation will be performed, and the authorization data. You can use either of the authorization ways:

    • the username and password of the Plesk user on behalf of which the operation will be performed.

    • a secret key – a line of text that you can obtain from Plesk via XML API and then use for authorization instead of the username and password. To create a secret key, you should specify the IP address and (or) login this secret key will be linked to. Then you can specify a secret key as the KEY HTTP header of request packets. The header can look as follows:

      KEY: 6575fae36288be6d1bad40b99808e37f

      For more information about secret keys, see the section Managing Secret Keys.

  2. The XML declaration: <?xml version="1.0" encoding="UTF-8" ?>

  3. The packet header specifying the version of XML API.

  4. The packet body defining the operations that the Plesk server should perform.

Hereinafter, we refer to the packet header and body together as packet.

The packet body is structured as follows:

<[operator]>
<[operation]>
      <[parameter1]>...</[parameter1]>
...
      <[parameter2]>...</[parameter2]>
      ...
</[operation]>
</[operator]>

This example shows the common structure of the packet body, with one [operator] element and one [operation] element within. In a particular implementation, labels [operator], [operation], [parameter] should be substituted by real operators, operations, and parameters. Refer to the next section for a packet sample.

Note: There can be many operation sections within one operator. Also, starting from XML API v. 1.4.0.0, a single packet allows specifying multiple operator elements.

You can look for particular values of labels [operator], [operation], and [parameter] in two places:

  • The Reference section of XML API, which presents the detailed description of how to create a request packet for a particular operation.
  • Alternatively you can form the packet on your own using the XML schemas.