Serverless Execution
Execute Command on Disk
Launches a container with the specified disk mounted, runs the given command to completion, and shuts down the container. Returns immediately with the container info; poll the container endpoint for completion.
POST
/
api
/
disks
/
{id}
/
exec
Execute a command on a disk
curl --request POST \
--url https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "ls -la /mnt/archil"
}
'import requests
url = "https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec"
payload = { "command": "ls -la /mnt/archil" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({command: 'ls -la /mnt/archil'})
};
fetch('https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'command' => 'ls -la /mnt/archil'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec"
payload := strings.NewReader("{\n \"command\": \"ls -la /mnt/archil\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"ls -la /mnt/archil\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"ls -la /mnt/archil\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"exitCode": 0,
"stdout": "<string>",
"stderr": "<string>",
"timing": {
"totalMs": 2450,
"queueMs": 150,
"executeMs": 2300
}
}
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}Authorizations
API key
Path Parameters
Disk ID (format dsk-{16 hex chars})
Pattern:
^dsk-[0-9a-f]{16}$Example:
"dsk-0123456789abcdef"
Body
application/json
Shell command to execute inside the container
Example:
"ls -la /mnt/archil"
Was this page helpful?
⌘I
Execute a command on a disk
curl --request POST \
--url https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"command": "ls -la /mnt/archil"
}
'import requests
url = "https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec"
payload = { "command": "ls -la /mnt/archil" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({command: 'ls -la /mnt/archil'})
};
fetch('https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'command' => 'ls -la /mnt/archil'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec"
payload := strings.NewReader("{\n \"command\": \"ls -la /mnt/archil\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"command\": \"ls -la /mnt/archil\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://control.green.us-east-1.aws.prod.archil.com/api/disks/{id}/exec")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"command\": \"ls -la /mnt/archil\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"exitCode": 0,
"stdout": "<string>",
"stderr": "<string>",
"timing": {
"totalMs": 2450,
"queueMs": 150,
"executeMs": 2300
}
}
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}{
"success": false,
"error": "Invalid request parameters"
}