• 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 REST Api How to create Webspace

mhalterbeck

New Pleskian
Hi everyone,

how do I create a Webhosting via REST Api?

I already created a User via API but my Problem is that I cant create a Webspace.

I used the following code:

<packet>
<webspace>
<add>
<gen_setup>
<name>domain_to_add</name>
<owner-id>2</owner-id>
<htype>vrt_hst</htype>
<ip_address>IP_of_plesk</ip_address>
<status>0</status>
</gen_setup>
<hosting>
<vrt_hst>
<property>
<name>ftp_login</name>
<value>ftp_login</value>
</property>
<property>
<name>ftp_password</name>
<value>ftp_password</value>
</property>
<property>
<name>fp</name>
<value>false</value>
</property>
<property>
<name>fp_ssl</name>
<value>false</value>
</property>
<property>
<name>fp_auth</name>
<value></value>
</property>
<property>
<name>fp_admin_login</name>
<value></value>
</property>
<property>
<name>fp_admin_password</name>
<value></value>
</property>
<property>
<name>ssl</name>
<value>true</value>
</property>
<property>
<name>php</name>
<value>true</value>
</property>
<property>
<name>php_handler_id</name>
<value>plesk-php74-fastcgi</value>
</property>
<property>
<name>ssi</name>
<value>false</value>
</property>
<property>
<name>cgi</name>
<value>true</value>
</property>
<property>
<name>perl</name>
<value>true</value>
</property>
<property>
<name>asp</name>
<value>false</value>
</property>
<property>
<name>asp_dot_net</name>
<value>false</value>
</property>
<property>
<name>webstat</name>
<value>awstats</value>
</property>
<property>
<name>webstat_protected</name>
<value>true</value>
</property>
<property>
<name>errdocs</name>
<value>false</value>
</property>
<property>
<name>php_version</name>
<value>7.4</value>
</property>
<property>
<name>webdeploy</name>
<value>false</value>
</property>
<property>
<name>www_root</name>
<value>/sample4</value>
</property>
<ip_address>IP_of_plesk</ip_address>
</vrt_hst>
</hosting>
<plan-name>Unlimited</plan-name>
</add>
</webspace>
</packet>
 
There is the REST API and the XML RCP API. The code you've posted is for the later. It will not work if you send it to the REST API. However I assume you are actually using the XML RCP API and mixed up the API names. If the XML code you are using isn't working then you'll likely get an error returned from the API. What does it say?

If you're looking for an example for the actual REST API to a look the code bellow.
{
"name": "example.com",
"description": "My website",
"hosting_type": "virtual",
"hosting_settings": {
"ftp_login": "test_login",
"ftp_password": "changeme1Q**"
},
"base_domain": {
"id": 7,
"name": "example.com",
"guid": "b623e93d-dc72-4102-b5f0-ded427cf0fb1"
},
"parent_domain": {
"id": 7,
"name": "example.com",
"guid": "b623e93d-dc72-4102-b5f0-ded427cf0fb1"
},
"owner_client": {
"id": 7,
"login": "owner",
"guid": "b623e93d-dc72-4102-b5f0-ded427cf0fb1",
"external_id": "b623e93d-dc72-4102-b5f0-ded427cf0fb1"
},
"ip_addresses": [
"93.184.216.34",
"2606:2800:220:1:248:1893:25c8:1946"
],
"ipv4": [
"93.184.216.34"
],
"ipv6": [
"2606:2800:220:1:248:1893:25c8:1946"
],
"plan": {
"name": "Unlimited"
}
}
 
Back
Top