• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Event handler?

bob231

Basic Pleskian
In case Plesk api creates a new subscription/domain with a specific service plan I want to automate that plesk/linux copy some webfiles and folders into the new httpdocs. What is the best way to do this?

I was thinking about the event "Domain created", but how to know if the specific service plan matched and only execute the command in that case?

Thanks, Bob
 
You can fetch additional details via XML-RPC API afterwards.

Here is the example of API call:
Code:
<packet>
  <webspace>
    <get>
      <filter>
        <id>11</id>
      </filter>
      <dataset>
        <gen_info/>
        <subscriptions/>
      </dataset>
    </get>
  </webspace>
</packet>

Response may look something like following:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.10.0">
  <webspace>
    <get>
      <result>
        <status>ok</status>
        <filter-id>11</filter-id>
        <id>11</id>
        <data>
          <gen_info>
            <cr_date>2017-07-06</cr_date>
            <name>admin.dom</name>
            <ascii-name>admin.dom</ascii-name>
            <status>0</status>
            <real_size>0</real_size>
            <owner-login>admin</owner-login>
            <dns_ip_address>10.58.108.108</dns_ip_address>
            <htype>vrt_hst</htype>
            <guid>1a292f67-47aa-4e99-99a1-36142c36d45e</guid>
            <vendor-guid>a26051b1-430c-4925-8b46-e487045e42cf</vendor-guid>
            <external-id/>
            <sb-site-uuid/>
            <description/>
            <admin-description/>
          </gen_info>
          <subscriptions>
            <subscription>
              <locked>false</locked>
              <synchronized>true</synchronized>
              <plan>
                <plan-guid>ae18b12f-af37-6dad-3219-9b5792b4a02c</plan-guid>
              </plan>
            </subscription>
          </subscriptions>
        </data>
      </result>
    </get>
  </webspace>
</packet>

So in case if subscription is created on particular service plan, node "subscriptions" will be present in the response. In case of "custom" subscription (no plan assignment) the node "subscriptions" will be absent.
 
Back
Top