Python (SDK)
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.servers.lock(server_id="sv_pbV0DgjKq4AWz")
# Handle response
print(res)package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Servers.Lock(ctx, "sv_pbV0DgjKq4AWz")
if err != nil {
log.Fatal(err)
}
if res.Server != 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.servers.lock({
serverId: "sv_pbV0DgjKq4AWz",
});
console.log(result);
}
run();curl --request POST \
--url https://api.latitude.sh/servers/{server_id}/lock \
--header 'Authorization: <api-key>'const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.latitude.sh/servers/{server_id}/lock', 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/servers/{server_id}/lock",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$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/servers/{server_id}/lock")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/servers/{server_id}/lock")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "sv_pbV0DgjKq4AWz",
"type": "servers",
"attributes": {
"hostname": "Heavy Duty Concrete Chair",
"label": "946654NODEUT",
"price": 599,
"ipmi_status": "Normal",
"scheduled_deletion_at": null,
"status": "unknown",
"role": "Enclosure",
"primary_ipv4": "150.158.19.54",
"created_at": null,
"locked": true,
"team": {
"id": "team_zAoElw92Z1c36A13Vx9EF71RlMl",
"name": "467 Team",
"slug": "467-team",
"description": "467 Team",
"address": "Suite 277 939 Hermann Mall, Hongshire, NH 77247-8873",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
},
"project": {
"id": "proj_Gr47qloZdAg0m",
"name": "Heavy Duty Linen Bottle",
"slug": "heavy-duty-linen-bottle",
"description": "Awesome Copper Lamp",
"billing_type": "Normal",
"billing_method": "Normal",
"bandwidth_alert": false,
"environment": null,
"billing": {
"subscription_id": "sub_6rq7u7562p9hap",
"type": "Normal",
"method": "Normal"
},
"stats": {
"databases": 0,
"ip_addresses": 0,
"prefixes": 0,
"servers": 1,
"storages": 0,
"virtual_machines": 0,
"vlans": 0
}
},
"region": {
"city": "Frankfurt 132",
"country": "Germany 147",
"site": {
"id": "loc_Gr47ql4vqAg0m",
"name": "Frankfurt 132",
"slug": "FRA113",
"facility": "Frankfurt 132"
}
}
}
}
}Servers
Lock server
Locks the server. A locked server cannot be deleted or modified and no actions can be performed on it.
POST
/
servers
/
{server_id}
/
lock
Python (SDK)
from latitudesh_python_sdk import Latitudesh
import os
with Latitudesh(
bearer=os.getenv("LATITUDESH_BEARER", ""),
) as latitudesh:
res = latitudesh.servers.lock(server_id="sv_pbV0DgjKq4AWz")
# Handle response
print(res)package main
import(
"context"
"os"
latitudeshgosdk "github.com/latitudesh/latitudesh-go-sdk"
"log"
)
func main() {
ctx := context.Background()
s := latitudeshgosdk.New(
latitudeshgosdk.WithSecurity(os.Getenv("LATITUDESH_BEARER")),
)
res, err := s.Servers.Lock(ctx, "sv_pbV0DgjKq4AWz")
if err != nil {
log.Fatal(err)
}
if res.Server != 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.servers.lock({
serverId: "sv_pbV0DgjKq4AWz",
});
console.log(result);
}
run();curl --request POST \
--url https://api.latitude.sh/servers/{server_id}/lock \
--header 'Authorization: <api-key>'const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
fetch('https://api.latitude.sh/servers/{server_id}/lock', 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/servers/{server_id}/lock",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$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/servers/{server_id}/lock")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/servers/{server_id}/lock")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"id": "sv_pbV0DgjKq4AWz",
"type": "servers",
"attributes": {
"hostname": "Heavy Duty Concrete Chair",
"label": "946654NODEUT",
"price": 599,
"ipmi_status": "Normal",
"scheduled_deletion_at": null,
"status": "unknown",
"role": "Enclosure",
"primary_ipv4": "150.158.19.54",
"created_at": null,
"locked": true,
"team": {
"id": "team_zAoElw92Z1c36A13Vx9EF71RlMl",
"name": "467 Team",
"slug": "467-team",
"description": "467 Team",
"address": "Suite 277 939 Hermann Mall, Hongshire, NH 77247-8873",
"status": "verified",
"currency": {
"id": "cur_AW6Q2D9lqKLpr",
"code": "BRL",
"name": "Brazilian Real",
"currency_id": null
}
},
"project": {
"id": "proj_Gr47qloZdAg0m",
"name": "Heavy Duty Linen Bottle",
"slug": "heavy-duty-linen-bottle",
"description": "Awesome Copper Lamp",
"billing_type": "Normal",
"billing_method": "Normal",
"bandwidth_alert": false,
"environment": null,
"billing": {
"subscription_id": "sub_6rq7u7562p9hap",
"type": "Normal",
"method": "Normal"
},
"stats": {
"databases": 0,
"ip_addresses": 0,
"prefixes": 0,
"servers": 1,
"storages": 0,
"virtual_machines": 0,
"vlans": 0
}
},
"region": {
"city": "Frankfurt 132",
"country": "Germany 147",
"site": {
"id": "loc_Gr47ql4vqAg0m",
"name": "Frankfurt 132",
"slug": "FRA113",
"facility": "Frankfurt 132"
}
}
}
}
}Was this page helpful?
⌘I