• 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 Virtual Host Template Applied to REST API Domains?

jPG

New Pleskian
Hello,

I recently configured a virtual host template successfully applied to any new domain created manually in Plesk. When I use the Plesk REST API to create domains, the virtual host template is not applied. Is it possible to apply a virtual host template on API created domains?

Here's my current PHP API call function:

function createDomain($domain, $secretKey, $parentDomainGuid, $ownerClientGuid, $ipv4, $ipv6, $domainId){
$url = "https://" . $domain . ":8443/api/v2/domains";
$folder = $this->account->install_folder;
$request = array (
'name' => $folder . ' . ' . $domain,
'hosting_type' => 'virtual',
'hosting_settings' =>
array (
"www_root" => 'httpdocs/' . $folder,
'certificate_name'=> 'Lets Encrypt ' . $domain
),
'parent_domain' =>
array (
'id' => $domainId,
'name' => $domain,
'guid' => $parentDomainGuid,
),
'owner_client' =>
array (
'id' => 1,
'login' => 'admin',
'guid' => $ownerClientGuid,
'external_id' => '',
),
'ipv4' =>
array (
0 => $ipv4,
),
'ipv6' =>
array (
0 => $ipv6,
),
'plan' =>
array (
'name' => 'Unlimited',
),
);
}

Thanks in advance!
jPG
 
Also, could you explain your issue in more detail? What's different on your domain when you create it trough the REST API compared to when you manually create a domain?
 
Yeah, sorry. I am running Plesk Obsidian 18.0.42 and trying to add a vhost_nginx.conf file to the virtual template "conf" folder. It works like a charm for domains I create manually but not for the ones created by the API. Just wondering if I am missing something...
 
I would suggest contacting Plesk support and explaining your issue in detail to them so they can investigate the issue. Perhaps it's an undocumented limitation on the REST API or even a bug. If it's not, I am sure they can offer a possible solution.
 
Back
Top