A Sample Packet

Here is an example of a request packet sent to the Plesk server:

POST /enterprise/control/agent.php HTTP/1.1

Host: 10.58.83.1:8443

Accept: */*

HTTP_AUTH_LOGIN: admin

HTTP_AUTH_PASSWD: setup

Pragma: no-cache

Content-Length: 1398

Content-Type: text/xml

HTTP header

The HTTP header indicates that the HTTP method used is POST, the handling agent is located at /enterprise/control/agent.php, and the HTTP version is 1.1. The Host element specifies the IP address and port of the server to which the message is addressed. HTTP_AUTH_LOGIN and HTTP_AUTH_PASSWD elements hold the Administrator’s credentials. The Content-Type must be "text/xml". The length of the passed message is also required.

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

XML declaration

<packet>

Packet header

<customer>
<add>
   <gen_info>
       <cname>LogicSoft Ltd.</cname>
       <pname>Stephen Lowell</pname>
       <login>stevelow</login>
       <passwd>Jhtr66fBB</passwd>
       <status>0</status>
       <phone>416 907 9944</phone>
       <fax>928 752 3905</fax>
       <email>host@logicsoft.net</email>
       <address>105 Brisbane Road, Unit 2</address>
       <city>Toronto</city>
       <state/>
       <pcode/>
       <country>CA</country>
   </gen_info>
</add>
</customer>

Packet body

Always starts from the tag of the related operator.

This particular packet uses the customer operator to create a customer account. The elements nested within the gen_info node contain the profile details.

 

The structure of the packet body is compliant with the client_input.xsd XML schema of XML API 1.6.3.0.

</packet>

Trailing tag closing the packet

Note: Instead of  the lines HTTP_AUTH_LOGIN: admin and HTTP_AUTH_PASSWD: setup in the request packet header, you can specify a secret key, for example: KEY: 6575fae36288be6d1bad40b99808e37f. For more information about the secret keys, see the section Managing Secret Keys.

 

The example above shows the request message structure. Both types are similar in the structure, but HTTP headers and bodies look different. Message sent by the server in response to the request above could look as follows:

HTTP/1.1 200 OK

Connection: close

Content-Length: 161

Content-Type: text/xml

Date: Mon, 3 Jul 2006 10:55:08 GMT

Server: Plesk/800

Standard header of the HTTP server response

The MIME type is text/xml.

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

Standard header of a valid XML document

<packet>

XML packet header

<customer>
    <add>
      <result>
        <status>ok</status>
        <id>4</id>
        <guid>0e35bf3c-5eb0-4006-98c6-5ce4ef4a08a7</guid>
      </result>   </add>
</customer>

Packet body

The root node of the packet body is the customer operator.

 

The nested lines indicate that the ADD operation was successfully performed. Also, the server passes back the account ID.

 

The structure of the packet body is compliant with the client_output.xsd XML schema of XML API v.1.6.3.0.

</packet>

Trailing tag closing the packet

 

Leave your comments on this page

Leave your feedback or question on this documentation topic below. For technical assistance, contact your hosting service provider or submit a request to Plesk support. Suggest new features for Plesk here. Discuss general questions on the Plesk forum. All offtopic comments will be removed.