Create database
Create a new database on your server.
POST/api/servers/{server}/databases
Create a database
This endpoint allows you to create a new database on your server. You can optionally create a database user at the same time.
Required attributes
- Name
name- Type
- string
- Description
The database name. Allowed: alpha-numeric characters, dashes and underscores. Min: 2, Max: 64.
Optional attributes
- Name
user- Type
- string
- Description
Username for database access. Allowed: alpha-numeric characters, dashes and underscores. Min: 2, Max: 64.
- Name
password- Type
- string
- Description
Password to connect to your database.
- Name
description- Type
- string
- Description
Ability to give your database a description for clarity (also shows in panel).
- Name
site_id- Type
- integer
- Description
Ability to attach a site to your database.
Request
POST
/api/servers/{server}/databasescurl -X POST "https://ploi.io/api/servers/{server}/databases" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"name": "my_database",
"user": "db_user",
"password": "secure_password"
}'
Response
{
"data": {
"id": 1,
"type": "mysql",
"name": "my_database",
"server_id": 1,
"status": "created",
"created_at": "2019-07-16 13:05:58"
}
}