• Hi, Pleskians! We are running a UX testing of our upcoming product intended for server management and monitoring.
    We would like to invite you to have a call with us and have some fun checking our prototype. The agenda is pretty simple - we bring new design and some scenarios that you need to walk through and succeed. We will be watching and taking insights for further development of the design.
    If you would like to participate, please use this link to book a meeting. We will sent the link to the clickable prototype at the meeting.
  • (Plesk for Windows):
    MySQL Connector/ODBC 3.51, 5.1, and 5.3 are no longer shipped with Plesk because they have reached end of life. MariaDB Connector/ODBC 64-bit 3.2.4 is now used instead.
  • 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.

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