curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["ls", "-la", "/home/user"], "shell": false}'
curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["dir", "C:\\Users"], "shell": true}'
curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["open", "-a", "Safari"], "shell": false}'
{
"stdout": "total 48\ndrwxr-xr-x 12 user user 4096 Nov 20 10:00 .\ndrwxr-xr-x 3 root root 4096 Nov 15 08:00 ..\n-rw-r--r-- 1 user user 220 Nov 15 08:00 .bash_logout\n",
"stderr": "",
"exit_code": 0
}
{
"stdout": "",
"stderr": "ls: cannot access '/nonexistent': No such file or directory",
"exit_code": 2
}
Data Plane
Execute
Execute a shell command or script inside the VM
POST
/
execute
curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["ls", "-la", "/home/user"], "shell": false}'
curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["dir", "C:\\Users"], "shell": true}'
curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["open", "-a", "Safari"], "shell": false}'
{
"stdout": "total 48\ndrwxr-xr-x 12 user user 4096 Nov 20 10:00 .\ndrwxr-xr-x 3 root root 4096 Nov 15 08:00 ..\n-rw-r--r-- 1 user user 220 Nov 15 08:00 .bash_logout\n",
"stderr": "",
"exit_code": 0
}
{
"stdout": "",
"stderr": "ls: cannot access '/nonexistent': No such file or directory",
"exit_code": 2
}
Executes a shell command or script inside the VM. Use this for programmatic control of the desktop environment.
Replace
VM_API_IP:PORT with the actual IP and port of the VM’s Desktop Environment API server.Request Body
array
required
Command and arguments as an array. For example:
["ls", "-la", "/home/user"]boolean
default:"false"
Whether to run the command in shell mode
Response
string
Standard output from the command
string
Standard error output from the command
number
Exit code of the command (0 = success)
curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["ls", "-la", "/home/user"], "shell": false}'
curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["dir", "C:\\Users"], "shell": true}'
curl -X POST "http://VM_API_IP:PORT/execute" \
-H "Content-Type: application/json" \
-d '{"command": ["open", "-a", "Safari"], "shell": false}'
{
"stdout": "total 48\ndrwxr-xr-x 12 user user 4096 Nov 20 10:00 .\ndrwxr-xr-x 3 root root 4096 Nov 15 08:00 ..\n-rw-r--r-- 1 user user 220 Nov 15 08:00 .bash_logout\n",
"stderr": "",
"exit_code": 0
}
{
"stdout": "",
"stderr": "ls: cannot access '/nonexistent': No such file or directory",
"exit_code": 2
}