SSH endpoints
This document contains the endpoints for the SSH category.
Execute SSH Command
/api/v1/ssh/execute
Authorized
Executes a command on a remote host via SSH
Parameters
Name
Type
In
Required
Description
sshRequest
object
body
optional
Body
Schema
{
"command" : "string" ,
"enable_insecure_key" : "bool" ,
"host" : "string" ,
"key" : "string" ,
"password" : "string" ,
"port" : "int" ,
"username" : "string"
}
Request examples
/v1/ssh/execute
Authorized
curl --location 'http://localhost/api/v1/ssh/execute'
--header 'Authorization ••••••'
--header 'Content-Type: application/json'
--data '{
"command": "string",
"enable_insecure_key": "bool",
"host": "string",
"key": "string",
"password": "string",
"port": "int",
"username": "string"
}'
var client = new HttpClient ();
var request = new HttpRequestMessage ( HttpMethod . Post , "http://localhost/api/v1/ssh/execute" );
request . Headers . Add ( "Authorization" , "••••••" );
request . Headers . Add ( "Content-Type" , "application/json" );
request . Content = new StringContent ( "{
"command" : "string" ,
"enable_insecure_key" : "bool" ,
"host" : "string" ,
"key" : "string" ,
"password" : "string" ,
"port" : "int" ,
"username" : "string"
} ");
request . Content = content ;
var response = await client . SendAsync ( request );
response . EnsureSuccessStatusCode ();
var responseString = await response . Content . ReadAsStringAsync ();
package main
import (
"fmt"
"net/http"
"strings"
"io"
)
func main () {
url := "http://localhost/api/v1/ssh/execute"
method := "post"
payload := strings . NewReader ( `{
"command": "string",
"enable_insecure_key": "bool",
"host": "string",
"key": "string",
"password": "string",
"port": "int",
"username": "string"
}` )
client := & http . Client {}
req , err := http . NewRequest ( method , url , payload )
if err != nil {
fmt . Println ( err )
return
}
req . Header . Add ( "Content-Type" , "application/json" )
req . Header . Add ( "Authorization" , "••••••" )
res , err := client . Do ( req )
if err != nil {
fmt . Println ( err )
return
}
defer res . Body . Close ()
body , err := io . ReadAll ( res . Body )
if err != nil {
fmt . Println ( err )
return
}
fmt . Println ( string ( body ))
}
Responses
{
"error" : "string" ,
"output" : "string"
}