Integration and Automation Capabilities

This chapter provides a bird's eye view of Plesk integration capabilities. Using these, you can control Plesk objects, react to Plesk events, make your applications available to Plesk users, and build own GUI into Plesk. In this chapter, we will briefly mention each of the integration capabilities and give our recommendations on when to use them.

Performing Create, Read, Update, Delete (CRUD) Operations on Plesk Objects

A typical integration task is to manage Plesk objects (service plans, customer accounts, and so on) more quickly, bypassing the Plesk GUI. This task is relevant to administrators who manage a number of Plesk servers and wish to automate day-to-day operations. It is also important for integrators who need to set up relations between objects in Plesk and their application. There are two ways to complete the task:

  • Make an appropriate Command Line Interface (CLI) call.
  • Make an appropriate XML API call.

   

CRUD operations from CLI

CLI is a set of utilities that perform almost all operations on Plesk objects from the command line. A popular use of this interface is to replace typical GUI operations with utility calls, create shell scripts, and run them on demand. To call one of the utilities, you should have administrative permissions on Plesk server.

 

Each CLI utility specializes in operations on a certain Plesk object (for example, a customer account) and has a specific syntax. You can learn about the syntax either from the built-in help or from the corresponding documentation.

Learn more about how to get started using CLI in the chapter Command-Line Interface (CLI).

For complete information about CLI, refer to Plesk 12.5 Command Line Reference (Windows) and Plesk 12.5 Command Line Reference (Linux).

 

The major limitation of CLI is that you can only use it from a local server and only on behalf of the administrator. Alternatively, use the XML API protocol if you require more flexibility, for example:

  • Work with a remote Plesk server.
  • Manage objects located on several Plesk servers at the same time.
  • Run operations on behalf of a reseller or a customer.

   

CRUD operations from XML API

The XML API protocol allows you to manipulate Plesk objects by exchanging XML-structured packets with Plesk. Each operation in XML API is presented as an XML structure that you send to a certain HTTP endpoint. Plesk receives the operation request, processes it, and also responds with an XML-structured packet. Each such response includes an operation status and operation-related details. For example, if you request information about a customer account, the account details will be returned in XML.

 

An operation request packet also includes information about a Plesk user on behalf of whom the operation is performed. This lets you automate the routines of any Plesk user.

  

Every operation available through CLI is also available through XML API. This makes XML API a more powerful tool, though the protocol implementation assumes programming efforts on your part (you should write a client application that sends and receives XML-over-HTTP packets).

Learn more about how to get started using XML API in the XML API Protocol chapter.

For complete information about XML API, refer to XML API Manual.

Monitoring Plesk Events by Using Event Handlers

Another typical integration task is to react to a particular operation on a Plesk object. Examples of when such a reaction is important are as follows:

  • Keep the app and Plesk objects synced.

    For example, if your application needs to have the same list of customer accounts as Plesk does, you should track the creation of customer accounts and create a new account every time Plesk creates one.

  • Generate custom statistics and notifications.

    For instance, one may need to receive an email each time a service utilized by Plesk is stopped.

To track Plesk operations and react correspondingly, employ event handlers.

 

An event handler is a link between a particular operation and an instruction: When Plesk completes the operation, it runs the linked instruction. The operation list is vast, so you can control almost all business logic operations. The instruction to trigger is usually a script or a binary. Depending on the operation, the instruction receives environmental variables that contain information about an operation target (Plesk object) "before" and "after" the operation. For example, the environment variables keep "old" and "new" customer account names in case the account name was changed.

Learn more about how to get started using event handlers in the Event Handlers chapter.

For complete information about event handlers, refer to the Administrator’s Guide, chapter Event Tracking.

Receiving Notifications About Changes in Subscriptions, Sites, and Email Accounts with Plesk Notifications

The other way for you to integrate an application into Plesk is to register it as an additional service. Such services are assigned to service plans and receive notifications about changes to plans instances - subscriptions and related objects (sites and email accounts). Registration is advisable only if you want to track these changes. For example, mail processing software should register in Plesk Notifications to track changes in the email account names of subscribers. In other words, Plesk Notifications is an extension of the event handler mechanism.

Learn more in Plesk Notifications.

Deliver Your Application as APS Package

When a web application is ready to market, the most convenient way for vendors to distribute the app is by adding it to the APS Catalog. The catalog is a part of Control Panel where customers can find an application and install it to their website. This ability to present third-party software in Plesk might be interesting to integrators especially if their application uses Plesk resources and has peculiarities in deployment and maintenance.

APS - Application Packaging Standard - is a set of rules that regulates web application installation, updates, licensing, and removal. If you make your application APS-compatible, you will not need to worry about application delivery because Plesk will carry out all the installation and maintenance operations for you.

Learn more about how to get started with APS packaging in the APS Packages chapter.

For complete information about APS packaging, refer to http://doc.apsstandard.org/_downloads/package-format-specification-12.pdf.

Build Your App into the Plesk GUI

Earlier versions of Plesk provided the mechanism of extending its base functionality with plug-ins called extensions (former modules). These plug-ins could access Plesk resources and have custom pages inside the Plesk GUI. The earlier versions of SDK and the corresponding documents are incompatible with Plesk 12.5, and for this reason, we recommend that you refer to the Developing Extensions for Plesk.

For information about developing extensions for Customer and Business Manager, refer to the Customer and Business Manager SDK.

Plesk Database Scheme

To manage Plesk objects with one of the described methods, you need to know the structure of the Plesk database objects. The Plesk database scheme is provided below in the three formats:

  1. MWB - the format of a project that can be opened in MySWL Workbench 6.3 unified visual tool. This free tools allows you to visualize and study the database, and additionaly
  2. SVG - vector format.
  3. XML - xml format.