• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Question How to add a new domain to an existing customer subscription using Plesk REST API?

Riculum

New Pleskian
Server operating system version
Ubuntu 24.04.2 LTS
Plesk version and microupdate number
18.0.71
I’m using Plesk REST API v2 to manage domains. I already have a customer (id=2) and an existing subscription (e.g. example.com). I want to add a second domain under that same subscription without creating a new subscription each time.

{
"name": "example.com",
"hosting_type": "virtual",
"hosting_settings": {
"ftp_login": "exampleftp",
"ftp_password": "secret"
},
"owner_client": { "id": 2 },
"ip_addresses": ["10.0.0.100"],
"plan": { "name": "Unlimited" }
}

This creates a new subscription/domain for that customer, but I want to add to the existing one instead.
 
Specify the base_domain and (or?) parent_domain objects in the json body of your API call. For example like:

JSON:
{
  "name": "example.com",
  "description": "My website",
  "hosting_type": "virtual",
  "hosting_settings": {
    "ftp_login": "test_login",
    "ftp_password": "changeme1Q**"
  },
  "base_domain": {
    "id": 7,
  },
  "parent_domain": {
    "id": 7,
  },
  "owner_client": {
    "id": 7
  },
  "ip_addresses": [
    "93.184.216.34"
  ],
  "plan": {
    "name": "Unlimited"
  }
}
 
Thanks! I just tried it, and including the base_domain with the correct id worked perfectly.

by the way: Is it possible to search for a client by login or email using the Plesk REST API?
 
[...]

by the way: Is it possible to search for a client by login or email using the Plesk REST API?
No, it's not possible to filter or search for clients. You'll have to loop trough all the results to find the customer you need using your own code (rather than have to API do the search for you).
 
Back
Top