• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Resolved Creating new subscription everytime a new domain is created with rest API

ElihuNavon

New Pleskian
Server operating system version
Plesk Obsidian Web Host Edition
Plesk version and microupdate number
18.0.53 update #2
I am using REST API to add a new domain to my plesk, but everytime I do that - the domain is added to an existing subscription.
Is there a way to make a new subscription for every new domain I add to my plesk account?
I'ts safer that way.
Thanks!
 
[...] Is there a way to make a new subscription for every new domain I add to my plesk account? [...]
Yes there is. Just omit the base_domain and parent_domain objects from the body of the API call.

So something like this should work:
JSON:
{
  "name": "example.com",
  "description": "My website",
  "hosting_type": "virtual",
  "hosting_settings": {
    "ftp_login": "test_login",
    "ftp_password": "Changeme1Q**sd23"
  },
    "owner_client": {
    "id": 2
  },
  "plan": {
    "name": "Unlimited"
  }
}
 
Last edited:
Yes there is. Just omit the base_domain and parent_domain objects from the body of the API call.

So something like should work:
JSON:
{
  "name": "example.com",
  "description": "My website",
  "hosting_type": "virtual",
  "hosting_settings": {
    "ftp_login": "test_login",
    "ftp_password": "Changeme1Q**sd23"
  },
    "owner_client": {
    "id": 2
  },
  "plan": {
    "name": "Unlimited"
  }
}

Hey! Kaspar, thank you VERY MUCH! You're a life-saver!
I'll be sure to try that!
I hope you don't mind me asking a follow-up question:
Is there also a way to add an SSL certificate using the API? After I added a new subscription and a new domain.
I assume there is, I'm just not sure exactly how to do that.
 
To my knowledge there isn't. However if you have enabled SSLit! as an additional service in the Service Plan of a domain to keep websites secured with free SSL/TLS certificates, an Let's Encrypt certificates will be issued automatically for the domain. This may take up to a couple of hours after the creation of a domain.
 
I am using REST API to add a new domain to my plesk, but everytime I do that - the domain is added to an existing subscription.
Is there a way to make a new subscription for every new domain I add to my plesk account?
I'ts safer that way.
Thanks!
can you please provide me with the json body , i want to add a domain to an active subscription
 
Back
Top