• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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