Skip to content

Database

Create Database

Parameters

Variable Necessity Type Description
name REQUIRED string Database Name
collation OPTIONAL string Dtabase Collation

HTTP REQUEST

POST https://api.cloudstick.io/api/v1/databases/servers/{server_id}/users/{user_id}

REQUEST

curl --request POST \
  --url 'https://api.cloudstick.io/api/v1/databases/servers/{server_id}/users/{user_id}?api_key={api-key}&secret_key={secret-key}' \
  --header 'Content-Type: application/json' \
  --data '{
    "name": "my_database_name"
}'

RESPONCE

{
  "id":011,
  "created_at":"2021-08-20T05:17:25.155748286Z",
  "name":"my_database_name",
  "server_id":001,
  "collation":"",
  "users":null,
  "is_backup_enabled":false
}

Create Database User

Parameters

Variable Necessity Type Description
name REQUIRED string Database User Name
password REQUIRED string Password (without special characters)

HTTP REQUEST

POST https://api.cloudstick.io/api/v1/dbusers/servers/{server_id}/users/{user_id}

REQUEST

curl --request POST \
  --url ‘https://api.cloudstick.io/api/v1/dbusers/servers/{server_id}/users/{user_id}?api_key={api-key}&secret_key={secret-key}’ \
  --header 'Content-Type: application/json' \
  --data '{
    "user_name": "my_db_usr",
    "Password": "password"
}'

RESPONCE

{
  "id": 011,
  "created_at": "2021-08-19T23:52:24.805376528-07:00",
  "user_name": "my_db_usr",
  "server_id": 001
}

Grant Privileges

Parameters

Variable Necessity Type Description
id REQUIRED string Database ID
privs REQUIRED string Privileges
host REQUIRED string Database host (localhost or remote)

HTTP REQUEST

POST https://api.cloudstick.io/api/v1/databases/servers/{server_id}/users/{user_id}

REQUEST

curl --request PUT \
  --url 'https://api.cloudstick.io/api/v1/databases/{db-id}/servers/{server-id}/users/{user-id}?api_key={api-key}&secret_key={secret-key}' \
  --header 'Content-Type: application/json' \
  --data '{
     "id":{db-user-id},
     "privs":["ALL","DELETE"],
     "host":"localhost"
}'

RESPONCE

to be filled

List Databases

HTTP REQUEST

GET https://api.cloudstick.io/api/v1/databases/servers/{server_id}/users/{user_id}

REQUEST

curl --request GET \
  --url ‘https://api.cloudstick.io/api/v1/databases/servers/{server_id}/users/{user_id}?api_key={api-key}&secret_key={secret-key}’ 

RESPONCE

Type :- 200 OK

Body :-
 [
  {
    "id": 700,
    "created_at": "2021-09-12T11:41:00.633554Z",
    "name": "vipintest_kemxy",
    "server_id": 759,
    "collation": "",
    "users": [
      {
        "id": 546,
        "created_at": "2021-09-12T11:41:00.63617Z",
        "user_name": "vipintest_vmtja",
        "server_id": 759,
        "privs": [
          "ALL"
        ]
      }
    ],
    "is_backup_enabled": false
  },
  {
    "id": 702,
    "created_at": "2021-09-16T12:18:42.810725Z",
    "name": "vipindb",
    "server_id": 759,
    "collation": "",
    "users": [],
    "is_backup_enabled": true
  },
  {
    "id": 703,
    "created_at": "2021-09-18T14:27:57.753585Z",
    "name": "vishnu_db",
    "server_id": 759,
    "collation": "",
    "users": [
      {
        "id": 548,
        "created_at": "2021-09-18T14:27:57.75633Z",
        "user_name": "vishnu_das",
        "server_id": 759,
        "privs": [
          "ALL"
        ]
      }
    ],
    "is_backup_enabled": false
  },
  {
    "id": 704,
    "created_at": "2021-09-19T15:28:12.363962Z",
    "name": "vipin75",
    "server_id": 759,
    "collation": "",
    "users": [
      {
        "id": 549,
        "created_at": "2021-09-19T15:28:12.366412Z",
        "user_name": "vipin1325",
        "server_id": 759,
        "privs": [
          "ALL"
        ]
      }
    ],
    "is_backup_enabled": false
  }
]

List Databse Users

HTTP REQUEST

GET https://api.cloudstick.io/api/v1/dbusers/servers/{server_id}/users/{user_id}

REQUEST

curl --request GET \
  --url ‘https://api.cloudstick.io/api/v1/dbusers/servers/{server_id}/users/{user_id}?api_key={api-key}&secret_key={secret-key}’ 

RESPONSE

{
    "id": 011,
    "created_at": "2021-08-19T23:52:24.805377Z",
    "user_name": "my_db_usr",
    "server_id": 001
}