Instance API
Instance List
GET /api/service/remote_service_instances
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
page: number;
page_size: number;
instance_name?: string;
status: string;
}
Response
{
"status": 200,
"data": {
"maxPage": 1,
"pageSize": 10,
"data": InstanceDetail[]
},
"time": 1718594177859
}
Instance Detail
GET /api/instance
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}
Response
{
"status": 200,
"data": InstanceDetail,
"time": 1718594177859
}
Create
POST /api/instance
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
}
Request Body
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf",
"config": InstanceConfig
},
"time": 1718594177859
}
Update Config
PUT /api/instance
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}
Request Body
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}
Delete
DELETE /api/instance
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string,
}
Request Body
{
"uuids": [
"50c73059001b436fa85c0d8221c157cf",
"11c2f4c89b9e4e1da819dc56bf16f151"
], // Instance Id
"deleteFile": false // Delete instance files
}
Response
{
"status": 200,
"data": [
"50c73059001b436fa85c0d8221c157cf",
"11c2f4c89b9e4e1da819dc56bf16f151"
], // Instance Id
"time": 1718594177859
}
Start
GET /api/protected_instance/open
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}
Stop
GET /api/protected_instance/stop
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}
Restart
GET /api/protected_instance/restart
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}
Kill
GET /api/protected_instance/kill
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
}
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}
Batch Operation
Support operations: start
, stop
, restart
, kill
POST /api/instance/multi_{{operations}}
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
instanceUuid: string,
daemonId: string,
}[]
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Update Instance
GET /api/protected_instance/asynchronous
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
task_name: "update"
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Send Command
GET /api/protected_instance/command
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
command: string
}
Response
{
"status": 200,
"data": {
"instanceUuid": "50c73059001b436fa85c0d8221c157cf"
},
"time": 1718594177859
}
Get output
GET /api/protected_instance/outputlog
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
uuid: string, // Instance ID
daemonId: string,
size?: number // Log size: 1KB ~ 2048KB
// if not set, return all logs
}
Response
{
"status": 200,
"data": "[INFO]: Done (12.138s)! For help, type \"help\"\n",
"time": 1718594177859
}
Reinstall
POST /api/protected_instance/install_instance
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string,
uuid: string // Instance ID
}
Request Body
{
"targetUrl": "https://files.example.com/Paper-1.20.4.zip",
"title": "Minecraft 1.20.4 Java",
"description": "[Paper] Low hardware configuration machine use, Fast setup."
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Type of InstanceConfig
{
"nickname": "New Name",
"startCommand": "cmd.exe",
"stopCommand": "^C",
"cwd": "/workspaces/my_server/",
"ie": "gbk", // input encode
"oe": "gbk", // output encode
"createDatetime": 1709631756708,
"lastDatetime": 1709631756708,
"type": "universal", // instance type
"tag": [],
"endTime": 1729631756708,
"fileCode": "gbk",
"processType": "docker",
"updateCommand": "shutdown -s",
"actionCommandList": [],
"crlf": 2,
"docker": DockerConfig,
// Steam RCON
"enableRcon": true,
"rconPassword": "123456",
"rconPort": 2557,
"rconIp": "192.168.1.233",
// Old fields
"terminalOption": {
"haveColor": false,
"pty": true,
},
"eventTask": {
"autoStart": false,
"autoRestart": true,
"ignore": false,
},
"pingConfig": {
"ip": "",
"port": 25565,
"type": 1,
}
}
Type of InstanceDetail
{
"config": InstanceConfig,
"info": {
"currentPlayers": -1,
"fileLock": 0,
"maxPlayers": -1,
"openFrpStatus": false,
"playersChart": [],
"version": "",
},
"instanceUuid": "50c73059001b436fa85c0d8221c157cf",
"processInfo": {
"cpu": 0,
"memory": 0,
"ppid": 0,
"pid": 0,
"ctime": 0,
"elapsed": 0,
"timestamp": 0
},
"space": 0,
"started": 6, // start count
"status": 3, // -1 = busy,
// 0 = stopped,
// 1 = stopping,
// 2 = starting,
// 3 = running
}
Type of Instance DockerConfig
{
"containerName": "",
"image": "mcsm-ubuntu:22.04",
"memory": 1024, // MB
"ports": ["25565:25565/tcp"],
"extraVolumes": [],
"maxSpace": null,
"network": null,
"io": null,
"networkMode": "bridge",
"networkAliases": [],
"cpusetCpus": "",
"cpuUsage": 100,
"workingDir": "",
"env": []
}