The add operation is used to register a custom option of service plans (additional service) in Panel database.

Request Packet Structure

A request XML packet registering a new additional service includes the add operation node:

<packet>
<plan-item>
   <add>
   ...
   </add>
</plan-item>
</packet>

The add node does not have a separate data type, it is nested within the complex type (plan_item.xsd). The add node has the following graphics representation:

image 67042.gif

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

  • The visible node is required. It specifies whether the additional service is available for adding to subscriptions. Data type: boolean.
  • The label node is required. It specifies the additional service name. Data type: text.
  • The tooltip node is required. It specifies additional service description. Data type: text.
  • The url node is optional. It specifies the URL attached to the custom button created for the additional service. Data type: urlType.
  • The internal node is optional. It defines if the URL is opened in the right Plesk frame or in the new window. Data type: boolean.
  • The noframe node is optional. If the URL leads to a Plesk extension or web app, this option specifies how the extension/app should be displayed on the Plesk page: in a frame or as a part of the Plesk GUI. The latter is recommended as the extension/app is seamlessly integrated into the Plesk GUI. Note that the noframe option is relevant only for the extensions/apps that support this feature. If an extension/app does not support the integration with the Plesk GUI, it will be displayed in a frame regardless of the noframe value. Data type: boolean.
  • The url-components node is optional. It specifies what information is included into HTTP request when a customer clicks a custom button for the additional service. Data type: PlanItemUrlComponentsType (plan_item.xsd). To see the structure of this node, proceed to topic url-components.
  • The image-file node is optional. It specifies the file name of background image for the custom button. Data type: string.

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

Response Packet Structure

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

image 67048.gif

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

  • The result node is required. It wraps the information about the operation execution and the list of webmail services. Data type: ResultType (common.xsd).
  • The status node is required. It specifies the execution status of the operation. Data type: result_status (string). Allowed values: ok | error.
  • The errcode node is optional. It returns the error code. Data type: unsignedInt.
  • The errtext node is optional. It returns the error message. Data type: string.
  • The name node is required. It specifies the additional service name. Data type: string.

Samples

Adding an additional service with attaching a custom button

This packet registers a new additional service in Plesk. The additional service is called New Service, its description is Additional service description, the additional service is available for adding to subscriptions, the URL attached to a custom button created for this additional service is http://domain.com, site ID and name, FTP user name and password is included into HTTP request when a customer clicks the custom button, the filename.png file is used as a background image for the custom button.

<packet>
<plan-item>
   <add>
      <visible>true</visible>
      <label>New Service</label>
      <tooltip>Additional service description.</tooltip>
      <url>http://domain.com</url>
      <internal>true</internal>
      <url-components>
         <dom-id>true</dom-id>
         <dom-name>true</dom-name>
         <ftp-user>true</ftp-user>
         <ftp-pass>true</ftp-pass>
         <cl-id>false</cl-id>
         <cname>false</cname>
         <pname>false</pname>
         <email>false</email>
      </url-components>
      <image-file>filename.png</image-file>
   </add>
</plan-item>
</packet>

Response:

<packet>
<plan-item>
   <add>
      <result>
         <status>ok</status>
         <name>plan-item</name>
      </result>
   </add>
</plan-item>
</packet>