• 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!
  • 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.

Plesk 12.5 API list domains under subscription

websavers

Regular Pleskian
Hey there,

I'm working with the Plesk API for version 12.5. I'm attempting to retrieve a list of domains (including subdomains and aliases) that are found under a specified subscription, but I can't seem to figure out how to make that happen.

I first tried this type of packet:

Code:
<packet>
  <customer>
    <get-domain-list>
      ...
    </get-domain-list>
  </customer>
</packet>

Which listed all domains across all of the customer's subscriptions, however only subdomains and aliases indicated which was their parent domain. All other domains did not provide a reference to indicate what subscription they're found under, so I was unable to then filter the results manually after the XML response.

I then attempted to retrieve information about a given subscription, with the idea that it would list all of the domains under the subscription:

Code:
<packet>
<webspace>
<get>
   <filter>
      <name>primary_domain.tld</name>
   </filter>
   <dataset>
      <hosting/>
   </dataset>
</get>
</webspace>
</packet>

However that only provides me with the primary domain's hosting details and nothing about the other domains/subdomains/aliases hosted under that subscription.

So I moved on to my final option of using the <site> type packet:

Code:
<packet>
<site>
    <get>
       <filter>
           <parent-name>subscription_primary_domain.tld</parent-name>
       <dataset>
            <hosting/>
       </dataset>
    </get>
</site>

Which also fails because it only returns a single site (a subdomain, but not any of the normal domains).

UPDATE: I got this <site> request to work. The reason it was only returning a single site rather than a complete array was not the API's fault, but rather the fault of my Plesk-API library which failed to indicate in the documentation that it has a SHORT/FULL request return option that defaults to short. This means that it was automatically traversing down the XML tree to the first result and returning that value, thus cutting out all remaining results. To fix it I needed to pass a second parameter to the request() function indicating to use the FULL request format.

---

After this much testing I have the following questions:

a) Why is there no reference, particularly under the get-domain-list option, for each of the domains to their parent subscription?

b) Why do <webspace> requests not allow for a <get-all-domains> for that webspace?

c) Why does a <site> request not return more than one result when it indicates that it should? (This question is no longer valid with the UPDATE above).

a) and b) still seem like decent questions though, particularly the first one.

-Jordan
 
Last edited:
Back
Top