• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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