Create database
POST /servers/{serverId}/databases
Parameters
name required | String | Name of the Database |
collation optional | String | Database collation. You can get this value from Static Data API. |
HTTP Request
POST https://manage.runcloud.io/api/v2/servers/{serverId}/databases
Request
curl --request POST \
--url https://manage.runcloud.io/api/v2/servers/7/databases \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"name": "my_database"
}'
Response
{
"id": 87,
"name": "my_database",
"collation": null,
"created_at": "2019-06-21 05:04:38"
}
List databases
GET /servers/{serverId}/databases
Query String Parameters
search optional | String | Searching string if you wanted to search from list of database |
HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/databases
Request
curl --request GET \
--url https://manage.runcloud.io/api/v2/servers/7/databases \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json'
Response
{
"data": [
{
"id": 81,
"name": "appDibbert_1559499789",
"collation": null,
"created_at": "2019-06-02 18:23:09"
},
{
"id": 87,
"name": "my_database",
"collation": null,
"created_at": "2019-06-21 05:04:38"
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 15,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Database object
GET /servers/{serverId}/databases/{databaseId}
HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/databases/{databaseId}
Request
curl --request GET \
--url https://manage.runcloud.io/api/v2/servers/7/databases/87 \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json'
Response
{
"id": 87,
"name": "my_database",
"collation": null,
"created_at": "2019-06-21 05:04:38"
}
Delete database
DELETE /servers/{serverId}/databases/{databaseId}
Parameters
deleteUser optional | Boolean | Delete all database user associated with this database |
HTTP Request
DELETE https://manage.runcloud.io/api/v2/servers/{serverId}/databases/{databaseId}
Request
curl --request DELETE \
--url https://manage.runcloud.io/api/v2/servers/7/databases/88 \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"deleteUser": true
}'
Response
{
"id": 88,
"name": "my_database2",
"collation": null,
"created_at": "2019-06-21 07:01:42"
}
Create database user
POST /servers/{serverId}/databaseusers
Parameters
username required | String | Username of the database user |
password required | String | Password for the database user |
HTTP Request
POST https://manage.runcloud.io/api/v2/servers/{serverId}/databaseusers
Request
curl --request POST \
--url https://manage.runcloud.io/api/v2/servers/7/databaseusers \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"username": "test_user",
"password": "mysupersecretpassword"
}'
Response
{
"id": 59,
"username": "test_user",
"created_at": "2019-06-21 07:49:43"
}
List database users
GET /servers/{serverId}/databaseusers
Query String Parameters
search optional | String | Searching string if you wanted to search from list of database user |
HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/databaseusers
Request
curl --request GET \
--url https://manage.runcloud.io/api/v2/servers/7/databaseusers \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json'
Response
{
"data": [
{
"id": 59,
"username": "test_user",
"created_at": "2019-06-21 07:49:43"
},
{
"id": 5,
"username": "test2",
"created_at": "2019-04-15 02:59:48"
}
],
"meta": {
"pagination": {
"total": 2,
"count": 2,
"per_page": 15,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Database User object
GET /servers/{serverId}/databaseusers/{databaseUserId}
HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/databaseusers/{databaseUserId}
Request
curl --request GET \
--url https://manage.runcloud.io/api/v2/servers/7/databaseusers/59 \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json'
Response
{
"id": 59,
"username": "test_user",
"created_at": "2019-06-21 07:49:43"
}
Update Database User password
PATCH /servers/{serverId}/databaseusers/{databaseUserId}
Parameters
password required | String | Password for the database user |
HTTP Request
PATCH https://manage.runcloud.io/api/v2/servers/{serverId}/databaseusers/{databaseUserId}
Request
curl --request PATCH \
--url https://manage.runcloud.io/api/v2/servers/7/databaseusers/59 \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"password": "my0th3rs3cr37p4ss"
}'
Response
{
"id": 59,
"username": "test_user",
"created_at": "2019-06-21 07:49:43"
}
Delete Database User
DELETE /servers/{serverId}/databaseusers/{databaseUserId}
HTTP Request
DELETE https://manage.runcloud.io/api/v2/servers/{serverId}/databaseusers/{databaseUserId}
Request
curl --request DELETE \
--url https://manage.runcloud.io/api/v2/servers/7/databaseusers/5 \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json'
Response
{
"id": 5,
"username": "test2",
"created_at": "2019-04-15 02:59:48"
}
Attach Database User to Database
POST /servers/{serverId}/databases/{databaseId}/grant
Parameters
id required | Integer | The id of Database User to attach to the database |
HTTP Request
POST https://manage.runcloud.io/api/v2/servers/{serverId}/databases/{databaseId}/grant
Request
curl --request POST \
--url https://manage.runcloud.io/api/v2/servers/7/databases/87/grant \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"id": 59
}'
Response
{
"id": 59,
"username": "test_user",
"created_at": "2019-06-21 07:49:43"
}
List granted users of a Database
GET /servers/{serverId}/databases/{databaseId}/grant
Query String Parameters
search optional | String | Searching string if you wanted to search from list of granted Database User |
HTTP Request
GET https://manage.runcloud.io/api/v2/servers/{serverId}/databases/{databaseId}/grant
Request
curl --request GET \
--url https://manage.runcloud.io/api/v2/servers/7/databases/87/grant \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json'
Response
{
"data": [
{
"id": 59,
"username": "test_user",
"created_at": "2019-06-21 07:49:43"
}
],
"meta": {
"pagination": {
"total": 1,
"count": 1,
"per_page": 15,
"current_page": 1,
"total_pages": 1,
"links": {}
}
}
}
Revoke granted users from a Database
DELETE /servers/{serverId}/databases/{databaseId}/grant
Parameters
id required | Integer | Id of a Database User to revoke from the Database |
HTTP Request
DELETE https://manage.runcloud.io/api/v2/servers/{serverId}/databases/{databaseId}/grant
Request
--request DELETE \
--url https://manage.runcloud.io/api/v2/servers/7/databases/87/grant \
-u YOUR_API_KEY:YOUR_API_SECRET \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"id": 59
}'
Response
{
"id": 59,
"username": "test_user",
"created_at": "2019-06-21 07:49:43"
}