Artica Wiki

Manage MySQL service using Web API service

Since Artica 4.50 Service pack 1, the Web API service lets you perform maintenance and monitoring operations on the MySQL/MariaDB service.

Since Artica 4.50 HotFix 20230911-11 or Service pack 1, the Web API service lets you perform maintenance and monitoring operations on the MySQL/MariaDB service.

Restart MySQL service

http://[server]:[port]/mysql/service/restart

Get MySQL Process lists

http://[server]:[port]/mysql/service/processes

List MySQL users

http://[server]:[port]/mysql/users

give a json with a “Users” attribute that lists all privileges and users.

{    
"Status": true,  "Error": "",
  "Users": [    {    
          "Reload_priv": "N",
          "File_priv": "N",
          "Create_tmp_table_priv": "N",
            . . . / . . .
          "User": "mariadb.sys",          
      },

Create a MySQL user

POST http://[server]:[port]/mysql/users/create

Using fields : 

Example: curl -d "User=user1&Host=%&Password=pass1" -X POST http://[server]:[port]/mysql/users/create

Grant a MySQL user to Admin privileges

POST http://[server]:[port]/mysql/users/grant

Using fields : 

Example: curl -d "User=user1&Host=%" -X POST http://[server]:[port]/mysql/users/grant

Revoke a MySQL user privileges

POST http://[server]:[port]/mysql/users/revoke

Using fields : 

Example: curl -d "User=user1&Host=%" -X POST http://[server]:[port]/mysql/users/revoke

Get MySQL user privileges

POST http://[server]:[port]/mysql/user/[username]/[host]

Example: curl http://[server]:[port]/mysql/user/root/localhost

List databases and privileges for an user

http://[server]:[port]/mysql/user/[username]/[host]/privileges

Example: curl http://[server]:[port]/mysql/user/dbuser/%/privileges

Grant database privileges for an user

http://[server]:[port]/mysql/database/grant/[database]/[username]/[host]

Example: curl http://[server]:[port]/mysql/database/grant/phpmyadmin/admin/localhost

Revoke database privileges for an user

http://[server]:[port]/mysql/database/revoke/[database]/[username]/[host]

Example: curl http://[server]:[port]/mysql/database/revoke/phpmyadmin/admin/localhost

List MySQL Databases and size

http://[server]:[port]/mysql/databases

Example: curl http://[server]:[port]/mysql/databases

Create a MySQL Database

http://[server]:[port]/mysql/database/create/[database]

Example: curl http://[server]:[port]/mysql/database/create/myDB

Delete a MySQL Database

POST http://[server]:[port]/mysql/database/delete/[database]

Example: curl http://[server]:[port]/mysql/database/delete/myDB