• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question Plesk REST API for PHP

Riculum

New Pleskian
Hello everyone

I am trying to automate the ordering process. I want to use the REST API and PHP. The official documentation is not very helpful, hardly anything is described. The swagger version is not very informative either. Does anyone know good documentation that describes how to create a new subscription?

Greetings
 
Thank you for the quick feedback. What do you mean by use 'subscription' CLI utility use. I see the command /cli/commands in the swagger documentation. This gives me a list. But how do I use it?
 
Hello, most recent documentation incl. swagger scheme and playground can be found under Tools & Settings > Server Management > Remote API (REST) page.
 
Example of creating a domain using REST API

Code:
POST https://{{api_host}}:{{api_port}}/api/v2/domains
Accept: application/json
X-API-Key: {{api_token}}

{
  "name": "test.dev",
  "hosting_type": "virtual",
  "hosting_settings": {
    "ftp_login": "test_login",
    "ftp_password": "test_password"
  },
  "plan": {
    "name": "Unlimited"
  }
}
 
I'm sorry, but I don't get it. I successfully created a user and a domain with CURL and PHP. However, I don't see in the documentation how to set this up for a subscription. Sorry, but there is nothing in the KB about how I use the CLI in PHP. I found this:

plesk bin subscription --create example.com -owner admin -service-plan "Default Domain" -ip 192.168.1.100 -login jdoe -passwd "userpass"

LINK: subscription: Subscriptions

How can I use this in PHP?
 
I don't see in the documentation how to set this up for a subscription.
When you use /domains endpoint in REST it creates a subscription when no 'base_domain' nor 'parent_domain' provided.

You can use all CLI commands using /cli endpoint like this
Code:
POST https://{{api_host}}:{{api_port}}/api/v2/cli/subscription/call
Accept: application/json
X-API-Key: {{api_token}}
{"params": ["--create", "example.com", "-owner", "admin", "-service-plan", "Default Domain", "-login", "jdoe", "-passwd", "userpass", "-ip", "10.58.108.108"]}
 
So if I understand correctly it automatically creates a subscription when I create a domain. Under "base_domain" you need an "id" and a "guid". The domain doesn't exist yet (will be created first). Where should I get these values from?
 
Back
Top