Using the API
After you read that all, you may think, “Does it have any API or something like that to interact with?”
Using API
Section titled “Using API”To start XManage API, use:
:~# xmanage api start
Accesing API in Web
Section titled “Accesing API in Web”Check if API is running
:~# xmanage api status
After that, check if your port is opened and check this URL:
http://<server_ip>:8041/ # or your own porthttps://<server_ip>:8041/ # in case of using it with SSL
Available API endpoints
Section titled “Available API endpoints”GET
/servers
Will show server list
POST
/servers
Will create new server
Data:
{ "server_name": "string", // e.g. myServer "cpu_limit": "string", // e.g. 100% "ram_limit": "string", // e.g. 128M "swap_limit": "string", // e.g. 100M "disk_limit": "string", // e.g. 1G "io_weight": 500, // int "ports": "string", // e.g. 3000 "startup": "string" // e.g. node index.js}
GET
/servers/<server id>
Shows server infomation
DELETE
/servers/<server id>
Deletes server
PATCH
/servers/<server id>
Updates server information
Data:
{ "server_name": "string", // e.g. myServer "cpu_limit": "string", // e.g. 100% "ram_limit": "string", // e.g. 128M "swap_limit": "string", // e.g. 100M "disk_limit": "string", // e.g. 1G "io_weight": 500, // int "ports": "string", // e.g. 3000 "startup": "string" // e.g. node index.js}
GET
/servers/<server id>/status
Shows server status
GET
/servers/<server id>/backups
Shows server’s backups
POST
/server/<server id>/backups
Creates backup using server’s files
DELETE
/server/<server id>/backups/<backup name>
Deletes server’s backup
GET
/servers/<server id>/files
Shows server files
GET
/servers/<server id>/logs
Shows last 50 lines from server logs
POST
/servers/<server id>/start
Starts server
POST
/servers/<server id>/stop
Stops server
POST
/servers/<server id>/restart
Restarts server
PUT
/servers/<server id>/backups/<backup name>
Restores server’s files from backup