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