• 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.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved REST API POST /domains

jimlongo56

Basic Pleskian
Trying to create a SUBDOMAIN with physical hosting.

Sending a POST call to the REST API creates the subdomain but it has no physical hosting attached to it.

The documentation states the choices are as follows
Code:
hosting_type:
        description: >-
          It specifies the hosting type of the created domain. Allowed values:
          `virtual` | `standard_forwarding` | `frame_forwarding` | `none`.

          Meanings: `virtual` - the domain ships with physical hosting.



How can I create a subdomain with hosting?



Code:
{
  "name": "subdomain.mywebsite.website",
  "description": "an autodomain",
  "hosting_type": "virtual",
  "hosting_settings": {
    "ftp_login": "test_login",
    "ftp_password": "test_pwd"
  },
  "parent_domain": {
     "id": 109,
     "name": "mywebsite.website",
     "guid": "dace833d-30b6-46a5-84ee-c5ab3ec9965c"
  },
  "owner_client":     {
        "id": 90,
        "login": "subdomain",
        "guid": "fa105651-2ba8-4d94-98f5-fda9d53d9ff7",
        "external_id": ""
  },
  "ipv4": [
    "xx.175.208.108"
  ],
  "plan": {
    "name": "Default"
  }
}
 
Last edited:
in case it helps, this will work to create the subdomain with physical webhosting. (don't use a parent domain)

Code:
{
  "name": "subdomain.mywebsite.website",
  "hosting_type": "virtual",
  "hosting_settings": {
    "ftp_login": "test_login",
    "ftp_password": "test_pwd"
  },
  "owner_client":     {
        "id": 6,
        "login": "mywebsite",
        "guid": "fa105651-2ba8-4d94-98f5-fda9d53d9ff7",
        "external_id": ""
  },
  "ipv4": [
    "xx.175.208.108"
  ],
  "plan": {
    "name": "Default"
  }
}


now how to specify a webroot for this new subdomain?

I mean this seems a little absurd.
You can create a subdomain with FTP, but you cannot specify a folder inside httdocs where the files will reside.
All the subdomains you create will FTP files to the same document root??o_O

Maybe I'm missing something obvious, but it's not documented.
 
Last edited:
So maybe the REST API is not the way to go.
Found this and it looks very promising . . .

Using the XML API, this is virtually straight from the documentation at Creating Subdomain

PROBLEM with this is the FTP Account is not being created. I get an ok, creates the subdomain with the proper root directory, but no FTP Account.

Code:
<packet>
    <subdomain>
        <add>
            <parent>xyzonline.website</parent>
            <name>topline1</name>
            <property>
                <name>www_root</name>
                <value>topline1</value>
            </property>
            <property>
                <name>ftp_login</name>
                <value>topline1</value>
            </property>
            <property>
                <name>ftp_password</name>
                <value>123abc456ABC!@#</value>
            </property>
        </add>
    </subdomain>
</packet>
Code:
<packet version="1.6.9.1">
    <subdomain>
        <add>
            <result>
                <status>ok</status>
                <id>162</id>
            </result>
        </add>
    </subdomain>
</packet>

Does anyone read this forum?
 
Last edited:
@jimlongo56, it must be a bit frustrating not getting any answers for a while, so just to reassure you, in my experience forums are read and issues are commented quite often... It's just that this topic might be less familiar to forum members, and additionally, it was the weekend.

We did some Plesk API integration in the past but I didn't work on that personally so I'm afraid I can't help you. :(
 
I've had a few questions and there just doesn't seem to be very much API support for developers.

Tried Discord, nothing there. There should at least be a dedicated developer forum, I'm never sure where I should post API related questions.

General Contact email often takes better part of a day for any response, and considering how imperfect a single email response can be, leads to more frustration.

It is a bit frustrating, with 2 APIs, various documentation in different places, and some of it just plain wrong . . .

We've developed plugins for other platforms and there's much better support channels.

Sorry for the rant, thanks for commenting.
 
Nothing like a good rant now and then... :D

Although, a lot of this also sounds like valid criticism to me.

Perhaps one of the staff members (I'll just mention @IgorG here so that he sees it right away...) can help with the communication channels so you can get the information you need.

Do tell them about the errors and omissions in the API documentation when you get in contact, I know I'd appreciate that for the future projects and I'm not the only one...
 
@jimlongo56 Indeed, questions about the features of using Plesk API usually cause difficulties in the community, since this is a complex and rare topic. Therefore, in order to get your question to the Plesk developers, I advise you to fill out a request here https://talk.plesk.com/forms/bugreports.1/respond and indicate there "YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:" as "Help with sorting out"
 
create a subdomain with plesk api use this json


{
"name": "newtestdom.example.com",
"description": "testing domain automation create",
"hosting_type": "virtual",
"hosting_settings": {
"ftp_login": "test_login",
"ftp_password": "test_login"
},

"parent_domain": {
"id": 105,
"name": "example.com",
"guid": "cccccccc-00c1-4945-a04f-zzzzzzzzzzzzz"
},
"owner_client": {
"id": 105,
"login": "owner",
"guid": "cccccccc-00c1-4945-a04f-zzzzzzzzzzzzz",
"external_id": "cccccccc-00c1-4945-a04f-zzzzzzzzzzzzz"
},
"ip_addresses": [
"xx.77.128.xx",
""
],
"ipv4": [
"xx.77.128.xx"
],
"ipv6": [
""
],
"plan": {
"name": "Unlimited"
}
}
 
Back
Top