• 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!
  • 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 RESTful API. Database <---> Site

pvl

New Pleskian
Hi!
Using the REST API, I created a customer, created a site.
Code:
###
GET https://ххх.хххххх.ххх:8443/api/v2/domains
X-API-Key:  *******-*****-****-****-*********
//Authorization:
Content-Type: application/json
Accept: application/json
{}
---
...
{
    "id": 23,
    "created": "2021-03-29",
    "name": "****.****.****.***",
    "ascii_name": "****.****.****.***",
    "base_domain_id": 0,
    "guid": "******-****-****-****-*********",
    "hosting_type": "virtual",
    "www_root": "\/var\/www\/vhosts\/****.****.****.***\/httpdocs"
}
...

Created the database

Code:
GET https://****.****.***:8443/api/v2/databases

HTTP/1.1 200 OK
Server: sw-cp-server
Date: Mon, 29 Mar 2021 15:29:32 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: *
Access-Control-Allow-Headers: *

[
  {
    "id": 16,
    "name": "wsl776s",
    "type": "mysql",
    "parent_domain": 23,
    "server_id": 1,
    "default_user_id": 0
  }
]

Response code: 200 (OK); Time: 354ms; Content length: 504 bytes

But the DB is not assigned to a site
Снимок экрана от 2021-03-29 18-43-03.png
How to assign a DB <--> site using API?
Thanks.
 
Last edited:
You'll probably have to use the CLI methode of the REST API to run either the or --register or --assign-to-subscription CLI database command.
Thanks for the answer. But this is a little different. The ---register- command assign the database to a subscription, not a site.
Code:
{
  "code": 2,
  "stdout": "",
  "stderr": "Database with such name is already registered."
}
The ---assign-to-subscription- command moves the database between subscriptions.
I have not yet found how to assign the database to a specific site in the subscription.
 
Back
Top