Go (SDK)
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.Lks.ListLksSites(ctx)
if err != nil {
log.Fatal(err)
}
if res.LksSites != nil {
// handle response
}
}curl --request GET \
--url https://api.latitude.sh/lks/sites \
--header 'Authorization: <api-key>'import requests
url = "https://api.latitude.sh/lks/sites"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.latitude.sh/lks/sites', 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/lks/sites",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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.get("https://api.latitude.sh/lks/sites")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/lks/sites")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "DAL2",
"type": "lks_sites",
"attributes": {
"name": "Dallas",
"slug": "DAL2",
"facility": "DAL2",
"country": {
"name": "United States",
"slug": "US"
}
}
},
{
"id": "SAO2",
"type": "lks_sites",
"attributes": {
"name": "Sao Paulo",
"slug": "SAO2",
"facility": "SAO2",
"country": {
"name": "Brazil",
"slug": "BR"
}
}
}
],
"meta": {
"total": 2
}
}{
"errors": [
{
"code": "UPSTREAM_SERVICE_ERROR",
"title": "Bad Gateway",
"detail": "NetBox is temporarily unavailable. Please try again.",
"status": "502",
"meta": {}
}
]
}LKS
List sites available for LKS
Lists the sites that can host an LKS cluster, one entry per site. Pass an entry’s id (the site slug) as site when creating a cluster. country is null when the underlying site has no region assigned.
GET
/
lks
/
sites
Go (SDK)
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.Lks.ListLksSites(ctx)
if err != nil {
log.Fatal(err)
}
if res.LksSites != nil {
// handle response
}
}curl --request GET \
--url https://api.latitude.sh/lks/sites \
--header 'Authorization: <api-key>'import requests
url = "https://api.latitude.sh/lks/sites"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.latitude.sh/lks/sites', 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/lks/sites",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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.get("https://api.latitude.sh/lks/sites")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.latitude.sh/lks/sites")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "DAL2",
"type": "lks_sites",
"attributes": {
"name": "Dallas",
"slug": "DAL2",
"facility": "DAL2",
"country": {
"name": "United States",
"slug": "US"
}
}
},
{
"id": "SAO2",
"type": "lks_sites",
"attributes": {
"name": "Sao Paulo",
"slug": "SAO2",
"facility": "SAO2",
"country": {
"name": "Brazil",
"slug": "BR"
}
}
}
],
"meta": {
"total": 2
}
}{
"errors": [
{
"code": "UPSTREAM_SERVICE_ERROR",
"title": "Bad Gateway",
"detail": "NetBox is temporarily unavailable. Please try again.",
"status": "502",
"meta": {}
}
]
}Was this page helpful?