Adding Available Databases Servers
The add operation is used to add a database to the list of database servers available within the subscription.
Request Packet Structure
A request XML packet adding a database to the list of databases available to the plan subscribers includes the add operation node:
<packet>
<webspace>
<db-servers>
<add>
...
</add>
</db-servers>
</webspace>
</packet>
The add node is presented by type WebspaceDbServerInput
(webspace.xsd
). Its graphical representation is as follows:
Note: The interactive schema navigator for all request packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_input.svg.
- The filter node is required. It serves to specify the criteria
by which the necessary service plans will be selected from the
database. Data type: d omainFilterType (
webspace.xsd
). See the Available Filters section for details on this node. - The db-server node is required. It specifies the database server that will be added to the list of available database servers. Data type: dbServerInput.
- The type node is required. It specifies the type of the database server. Data type: string.
- The id node is optional. It specifies the ID of the database server. Data type: string.
- The host node is optional. It specifies the host name of the database server. Data type: string.
- The port node is optional. It specifies the port on which the database server is available. Data type: string.
Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.
Response Packet Structure
The add node of the output XML packet is of complex type
(webspace.xsd)
which has the following presentation:
Note: The interactive schema navigator for all response packets is available here: http://plesk.github.io/api-schemas/1.6.8.0/agent_output.svg.
- The result node is optional. It wraps the response got from the
server. Data type: resultFilterType (
common.xsd
). - The status node is required. Specifies the execution status of the operation. Data type: string. Allowed values: ok | error.
- The errcode node is optional. Returns the error code when the operation fails. Data type: unsignedInt.
- The errtext node is optional. Returns the error message if the operation fails. Data type: string.
- The filter-id node is optional. Returns the parameter by which the service plan was filtered by in the request packet. Data type: anySimple.
- The id node is optional. Returns the identifier of the service
plan to which the application was added. Data type: id_type
(
common.xsd
).
Sample
The following request adds the MySQL database server available on the port 3306 of localhost to the list of database servers available within the subscription with id 1:
<packet>
<webspace>
<db-servers>
<add>
<filter>
<id>1</id>
</filter>
<db-server>
<type>mysql</type>
<host>localhost</host>
<port>3306</port>
</db-server>
<db-server>
<type>postgresql</type>
<host>localhost</host>
<port>5432</port>
</db-server>
</add>
</db-servers>
</webspace>
</packet>
A positive response got from the server after adding a database server to the list of database servers available within a subscription can look as follows:
<packet>
<webspace>
<db-servers>
<add>
<result>
<status>ok</status>
<filter-id>1</filter-id>
<id>1</id>
</result>
</add>
</db-servers>
</webspace>
</packet