Volumes
Update Volume
Update a volume’s configuration using the details provided in the request body.
PUT
/
v1
/
apps
/
{app_name}
/
volumes
/
{volume_id}
Update Volume
curl --request PUT \
--url https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id} \
--header 'Content-Type: application/json' \
--data '
{
"auto_backup_enabled": true,
"snapshot_retention": 123
}
'import requests
url = "https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}"
payload = {
"auto_backup_enabled": True,
"snapshot_retention": 123
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({auto_backup_enabled: true, snapshot_retention: 123})
};
fetch('https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}', 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://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'auto_backup_enabled' => true,
'snapshot_retention' => 123
]),
CURLOPT_HTTPHEADER => [
"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://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}"
payload := strings.NewReader("{\n \"auto_backup_enabled\": true,\n \"snapshot_retention\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}")
.header("Content-Type", "application/json")
.body("{\n \"auto_backup_enabled\": true,\n \"snapshot_retention\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"auto_backup_enabled\": true,\n \"snapshot_retention\": 123\n}"
response = http.request(request)
puts response.read_body{
"attached_alloc_id": "<string>",
"attached_machine_id": "<string>",
"auto_backup_enabled": true,
"block_size": 123,
"blocks": 123,
"blocks_avail": 123,
"blocks_free": 123,
"bytes_total": 123,
"bytes_used": 123,
"created_at": "<string>",
"encrypted": true,
"fstype": "<string>",
"host_features": [
"<string>"
],
"host_status": "ok",
"id": "<string>",
"name": "<string>",
"region": "<string>",
"required_host_features": [
"<string>"
],
"size_gb": 123,
"snapshot_retention": 123,
"state": "<string>",
"type": "local",
"zone": "<string>"
}{
"details": {},
"error": "<string>",
"status": "unknown"
}Response
OK
Available options:
ok, unknown, unreachable Available options:
local, cache ⌘I
Update Volume
curl --request PUT \
--url https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id} \
--header 'Content-Type: application/json' \
--data '
{
"auto_backup_enabled": true,
"snapshot_retention": 123
}
'import requests
url = "https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}"
payload = {
"auto_backup_enabled": True,
"snapshot_retention": 123
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({auto_backup_enabled: true, snapshot_retention: 123})
};
fetch('https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}', 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://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'auto_backup_enabled' => true,
'snapshot_retention' => 123
]),
CURLOPT_HTTPHEADER => [
"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://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}"
payload := strings.NewReader("{\n \"auto_backup_enabled\": true,\n \"snapshot_retention\": 123\n}")
req, _ := http.NewRequest("PUT", url, payload)
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.put("https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}")
.header("Content-Type", "application/json")
.body("{\n \"auto_backup_enabled\": true,\n \"snapshot_retention\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.machines.dev/v1/apps/{app_name}/volumes/{volume_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"auto_backup_enabled\": true,\n \"snapshot_retention\": 123\n}"
response = http.request(request)
puts response.read_body{
"attached_alloc_id": "<string>",
"attached_machine_id": "<string>",
"auto_backup_enabled": true,
"block_size": 123,
"blocks": 123,
"blocks_avail": 123,
"blocks_free": 123,
"bytes_total": 123,
"bytes_used": 123,
"created_at": "<string>",
"encrypted": true,
"fstype": "<string>",
"host_features": [
"<string>"
],
"host_status": "ok",
"id": "<string>",
"name": "<string>",
"region": "<string>",
"required_host_features": [
"<string>"
],
"size_gb": 123,
"snapshot_retention": 123,
"state": "<string>",
"type": "local",
"zone": "<string>"
}{
"details": {},
"error": "<string>",
"status": "unknown"
}