Python (SDK)
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.virtual_machine_backups.create_virtual_machine_backup_top_level()
# Handle response
print(res)package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/components"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.VirtualMachineBackups.Create(ctx, components.VirtualMachineBackupPayload{})
if err != nil {
log.Fatal(err)
}
if res.VirtualMachineBackup != nil {
// handle response
}
}import { Latitudesh } from "latitudesh-typescript-sdk";
const latitudesh = new Latitudesh({
bearer: process.env["LATITUDESH_BEARER"] ?? "",
});
async function run() {
const result = await latitudesh.virtualMachineBackups.create({});
console.log(result);
}
run();curl --request POST \
--url https://api.latitude.sh/virtual_machine_backups \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "virtual_machine_backups",
"attributes": {
"virtual_machine": "<string>"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {type: 'virtual_machine_backups', attributes: {virtual_machine: '<string>'}}
})
};
fetch('https://api.latitude.sh/virtual_machine_backups', 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.latitude.sh/virtual_machine_backups",
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([
'data' => [
'type' => 'virtual_machine_backups',
'attributes' => [
'virtual_machine' => '<string>'
]
]
]),
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;
}HttpResponse<String> response = Unirest.post("https://api.latitude.sh/virtual_machine_backups")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"virtual_machine_backups\",\n \"attributes\": {\n \"virtual_machine\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/virtual_machine_backups")
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 \"data\": {\n \"type\": \"virtual_machine_backups\",\n \"attributes\": {\n \"virtual_machine\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"type": "virtual_machine_backups",
"attributes": {
"size_bytes": 123,
"expires_at": "<string>",
"failure_reason": "<string>",
"created_at": "<string>",
"virtual_machine": {
"id": "<string>",
"name": "<string>"
},
"team": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"address": "<string>",
"currency": {
"id": "<string>",
"code": "<string>",
"name": "<string>",
"currency_id": 123
},
"status": "<string>",
"feature_flags": [
"<string>"
],
"limits": {
"bare_metal": 123,
"bare_metal_gpu": 123,
"virtual_machine": 123,
"virtual_machine_gpu": 123,
"elastic_ip": 123,
"virtual_network": 123,
"database": 123,
"filesystem": 123,
"block_storage": 123
}
},
"project": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"billing_type": "<string>",
"provisioning_type": "<string>",
"billing_method": "<string>",
"bandwidth_alert": true,
"environment": "<string>",
"billing": {
"subscription_id": "<string>",
"type": "<string>",
"method": "<string>"
},
"stats": {
"databases": 123,
"ip_addresses": 123,
"prefixes": 123,
"servers": 123,
"storages": 123,
"virtual_machines": 123,
"vlans": 123
}
}
}
},
"meta": {}
}{
"errors": [
{
"code": "FEATURE_NOT_ENABLED",
"message": "Virtual machine backups are not enabled for this team"
}
]
}Virtual machine backups
Create VM backup (top-level)
Triggers a backup of the Virtual Machine referenced in the body.
POST
/
virtual_machine_backups
Python (SDK)
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.virtual_machine_backups.create_virtual_machine_backup_top_level()
# Handle response
print(res)package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"github.com/latitudesh/latitudesh-go-sdk/models/components"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.VirtualMachineBackups.Create(ctx, components.VirtualMachineBackupPayload{})
if err != nil {
log.Fatal(err)
}
if res.VirtualMachineBackup != nil {
// handle response
}
}import { Latitudesh } from "latitudesh-typescript-sdk";
const latitudesh = new Latitudesh({
bearer: process.env["LATITUDESH_BEARER"] ?? "",
});
async function run() {
const result = await latitudesh.virtualMachineBackups.create({});
console.log(result);
}
run();curl --request POST \
--url https://api.latitude.sh/virtual_machine_backups \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"data": {
"type": "virtual_machine_backups",
"attributes": {
"virtual_machine": "<string>"
}
}
}
'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
data: {type: 'virtual_machine_backups', attributes: {virtual_machine: '<string>'}}
})
};
fetch('https://api.latitude.sh/virtual_machine_backups', 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.latitude.sh/virtual_machine_backups",
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([
'data' => [
'type' => 'virtual_machine_backups',
'attributes' => [
'virtual_machine' => '<string>'
]
]
]),
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;
}HttpResponse<String> response = Unirest.post("https://api.latitude.sh/virtual_machine_backups")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"data\": {\n \"type\": \"virtual_machine_backups\",\n \"attributes\": {\n \"virtual_machine\": \"<string>\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/virtual_machine_backups")
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 \"data\": {\n \"type\": \"virtual_machine_backups\",\n \"attributes\": {\n \"virtual_machine\": \"<string>\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"type": "virtual_machine_backups",
"attributes": {
"size_bytes": 123,
"expires_at": "<string>",
"failure_reason": "<string>",
"created_at": "<string>",
"virtual_machine": {
"id": "<string>",
"name": "<string>"
},
"team": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"address": "<string>",
"currency": {
"id": "<string>",
"code": "<string>",
"name": "<string>",
"currency_id": 123
},
"status": "<string>",
"feature_flags": [
"<string>"
],
"limits": {
"bare_metal": 123,
"bare_metal_gpu": 123,
"virtual_machine": 123,
"virtual_machine_gpu": 123,
"elastic_ip": 123,
"virtual_network": 123,
"database": 123,
"filesystem": 123,
"block_storage": 123
}
},
"project": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"billing_type": "<string>",
"provisioning_type": "<string>",
"billing_method": "<string>",
"bandwidth_alert": true,
"environment": "<string>",
"billing": {
"subscription_id": "<string>",
"type": "<string>",
"method": "<string>"
},
"stats": {
"databases": 123,
"ip_addresses": 123,
"prefixes": 123,
"servers": 123,
"storages": 123,
"virtual_machines": 123,
"vlans": 123
}
}
}
},
"meta": {}
}{
"errors": [
{
"code": "FEATURE_NOT_ENABLED",
"message": "Virtual machine backups are not enabled for this team"
}
]
}Was this page helpful?
⌘I