Database

Create database

Parameters
namerequiredStringName of the Database
collationoptionalStringDatabase collation. You can get this value from Static Data API.

POST /servers/{serverId}/databases

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

Query String Parameters
searchoptionalStringSearching string if you wanted to search from list of database

GET /servers/{serverId}/databases

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

Parameters
deleteUseroptionalBooleanDelete all database user associated with this database

DELETE /servers/{serverId}/databases/{databaseId}

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

Parameters
usernamerequiredStringUsername of the database user
passwordrequiredStringPassword for the database user

POST /servers/{serverId}/databaseusers

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

Query String Parameters
searchoptionalStringSearching string if you wanted to search from list of database user

GET /servers/{serverId}/databaseusers

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

Parameters
passwordrequiredStringPassword for the database user

PATCH /servers/{serverId}/databaseusers/{databaseUserId}

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

Parameters
idrequiredIntegerThe id of Database User to attach to the database

POST /servers/{serverId}/databases/{databaseId}/grant

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

Query String Parameters
searchoptionalStringSearching string if you wanted to search from list of granted Database User

GET /servers/{serverId}/databases/{databaseId}/grant

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

Parameters
idrequiredIntegerId of a Database User to revoke from the Database

DELETE /servers/{serverId}/databases/{databaseId}/grant

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"
}