Deprecation Notice - RunCloud API Beta is deprecated effective 31 May 2019. New API will be released and it's not backward compatible.

Database

Create a database user

Arguments
databaseUserrequiredUsername of the database user
passwordrequiredPassword for the user
verifyPasswordrequiredMust be same as "Password"

POST /servers/<server.id>/databaseusers

HTTP Request
POST https://manage.runcloud.io/base-api/servers/<server.id>/databaseusers
Request
curl -X POST "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databaseusers" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "databaseUser": "myfirstuser",
        "password": "sup3rs3cr37p455w0rd",
        "verifyPassword": "sup3rs3cr37p455w0rd"
    }'
Response
{
	"message": "Successfully added new database user myfirstuser",
	"redirect": "/servers/yO4VAbX2BkNz/databases"
}

List database users

Arguments
pageoptionalPage number of the resources
nameoptionalSearching string if you wanted to search from list of database user

GET /servers/<server.id>/databaseusers

HTTP Request
GET https://manage.runcloud.io/base-api/servers/<server.id>/databaseusers
Request
curl -X GET "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databaseusers?page=1" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
Response
{
	"data": [
		{
			"id": "w749ly7rayrg",
			"name": "myfirstuser",
			"_links": {
				"changepassword": {
					"method": "patch",
					"link": "/api/servers/yO4VAbX2BkNz/databaseusers/w749ly7rayrg"
				},
				"delete": {
					"method": "delete",
					"link": "/api/servers/yO4VAbX2BkNz/databaseusers/w749ly7rayrg"
				},
				"revoke": {
					"method": "delete",
					"links": []
				}
			}
		}
	],
	"meta": {
		"pagination": {
			"total": 1,
			"count": 1,
			"per_page": 10,
			"current_page": 1,
			"total_pages": 1,
			"links": []
		}
	}
}

Change password for database user

Arguments
passwordrequiredPassword for the user
verifyPasswordrequiredMust be same as "password"

PATCH /servers/<server.id>/databaseusers/<databaseuser.id>

HTTP Request
PATCH https://manage.runcloud.io/base-api/servers/<server.id>/databaseusers/<databaseuser.id>
Request
curl -X PATCH "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databaseusers/w749ly7rayrg" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "password": "ch4ng3dmyp4ssw0rd",
        "verifyPassword": "ch4ng3dmyp4ssw0rd"
    }'
Response
{
	"message": "Successfully changed password for myfirstuser.",
	"redirect": "/servers/yO4VAbX2BkNz/databases"
}

Create a database

Arguments
databaseNamerequiredName of the Database
databaseCollationoptionalDatabase collation

GET /cronjobs

HTTP Request
POST https://manage.runcloud.io/base-api/servers/<server.id>/databases
Request
curl -X POST "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databases" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "databaseName": "myfirstdatabase",
        "databaseCollation": "dec8_swedish_ci"
    }'
Response
{
	"message": "Successfully added new database myfirstdatabase.",
	"redirect": "/servers/yO4VAbX2BkNz/databases"
}

List databases

Arguments
pageoptionalPage number of the resources
nameoptionalSearching string if you wanted to search from list of database

GET /servers/<server.id>/databases

HTTP Request
GET https://manage.runcloud.io/base-api/servers/<server.id>/databases
Request
curl -X GET "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databases?page=1" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
Response
{
	"data": [
		{
			"id": "5xbKlEMeleXZ",
			"name": "myfirstdatabase",
			"collation": "dec8_swedish_ci",
			"restorationStatus": "IDLE",
			"_links": {
				"attachuser": {
					"method": "patch",
					"link": "/api/servers/yO4VAbX2BkNz/databases/5xbKlEMeleXZ/attach-user"
				},
				"delete": {
					"method": "delete",
					"link": "/api/servers/yO4VAbX2BkNz/databases/5xbKlEMeleXZ/destroy"
				}
			},
			"databaseUsers": []
		}
	],
	"meta": {
		"pagination": {
			"total": 1,
			"count": 1,
			"per_page": 10,
			"current_page": 1,
			"total_pages": 1,
			"links": []
		}
	}
}

Attach database user to database

POST /servers/<server.id>/databases/<database.id>/attachuser

HTTP Request
POST https://manage.runcloud.io/base-api/servers/<server.id>/databases/<database.id>/attachuser
Arguments
databaseUserrequiredUsername of a database user that you wanted to attach to this database
Request
curl -X POST "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databases/5xbKlEMeleXZ/attachuser" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "databaseUser": "myfirstuser"
    }'
Response
{
	"message": "Successfully attach user myfirstuser to database myfirstdatabase",
	"redirect": "/servers/yO4VAbX2BkNz/databases"
}

Revoke database user from database

Arguments
databaseUserrequiredUsername of a database user that you wanted to revoke from this database

DELETE /servers/<server.id>/databases/<database.id>/attachuser

HTTP Request
DELETE https://manage.runcloud.io/base-api/servers/<server.id>/databases/<database.id>/attachuser
Request
curl -X DELETE "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databases/5xbKlEMeleXZ/attachuser" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "databaseUser": "myfirstuser"
    }'
Response
{
	"message": "Successfully revoke myfirstuser access from myfirstdatabase"
}

Delete database user

Arguments
databaseUserrequiredUsername of a database user that you wanted to delete

DELETE /servers/<server.id>/databaseusers/<databaseuser.id>

HTTP Request
DELETE https://manage.runcloud.io/base-api/servers/<server.id>/databaseusers/<databaseuser.id>
Request
curl -X DELETE "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databaseusers/w749ly7rayrg" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "databaseUser": "myfirstuser"
    }'
Response
{
	"message": "Successfully deleted database user myfirstuser"
}

Delete database

Arguments
databaseNamerequiredNmae of the database that you wanted to delete

DELETE /servers/<server.id>/databases/<database.id>

HTTP Request
DELETE https://manage.runcloud.io/base-api/servers/<server.id>/databases/<database.id>
Request
curl -X DELETE "https://manage.runcloud.io/base-api/servers/yO4VAbX2BkNz/databases/5xbKlEMeleXZ" \
    -u YOUR_API_KEY:YOUR_API_SECRET \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    --data '{
        "databaseName": "myfirstdatabase"
    }'
Response
{
	"message": "Succesfully deleted database myfirstdatabase."
}