XPipe LogoXPipe Documentation

Execute command in a shell session

Runs a command in an active shell session and waits for it to finish. The exit code and output will be returned in the response. Note that a variety of different errors can occur when executing the command. If the command finishes, even with an error code, a normal HTTP 200 response will be returned. However, if any other error occurs like the shell not responding or exiting unexpectedly, an HTTP 500 response will be returned.

POST
/shell/exec

Authorization

AuthorizationRequiredBearer <token>

The bearer token used is the session token that you receive from the handshake exchange.

In: header

Request Body

application/jsonRequired
connectionRequiredstring

The connection uuid

commandRequiredstring

The command to execute

curl -X POST "http://localhost:21721/shell/exec" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "connection": "f0ec68aa-63f5-405c-b178-9a4454556d6b",
    "command": "echo $USER"
  }'

The operation was successful. The shell command finished.

{
  "summary": "echo $USER",
  "value": {
    "exitCode": 0,
    "stdout": "root",
    "stderr": ""
  }
}