Computes
List Compute Instances
Returns all compute instances associated with the team of the given API key.
GET
/
computes
List compute instances
curl --request GET \
--url https://api.strettch.cloud/api/v1/computes \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.strettch.cloud/api/v1/computes"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.strettch.cloud/api/v1/computes', 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.strettch.cloud/api/v1/computes",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.strettch.cloud/api/v1/computes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.strettch.cloud/api/v1/computes")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.strettch.cloud/api/v1/computes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "Operation successful",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": true,
"timestamp": "2024-01-15T10:00:00Z",
"meta": {
"total": 150,
"page": 1,
"limit": 20
},
"data": [
{
"id": "325",
"hostName": "my-server-01",
"state": "RUNNING",
"image": "UBUNTU-24.04",
"specification": "S-1C-1G",
"region": "KGL-1",
"ipv4": "195.15.0.73",
"privateIpv4": "10.0.0.5",
"tags": [
"production",
"web"
],
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:05:00Z"
}
]
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}Response Error Codes
If the request fails, thecode field in the error response will contain one of the following.
| Code | Status | Description |
|---|---|---|
UNAUTHORIZED | 401 | Authentication failed or was not provided. |
TOO_MANY_REQUESTS | 429 | You have exceeded the rate limit. |
INTERNAL_SERVER_ERROR | 500 | An unexpected error occurred on our end. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Was this page helpful?
Previous
Create Compute InstanceProvisions a new compute instance under the team associated with the given API key.
Next
⌘I
List compute instances
curl --request GET \
--url https://api.strettch.cloud/api/v1/computes \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.strettch.cloud/api/v1/computes"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.strettch.cloud/api/v1/computes', 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.strettch.cloud/api/v1/computes",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.strettch.cloud/api/v1/computes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.strettch.cloud/api/v1/computes")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.strettch.cloud/api/v1/computes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "Operation successful",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": true,
"timestamp": "2024-01-15T10:00:00Z",
"meta": {
"total": 150,
"page": 1,
"limit": 20
},
"data": [
{
"id": "325",
"hostName": "my-server-01",
"state": "RUNNING",
"image": "UBUNTU-24.04",
"specification": "S-1C-1G",
"region": "KGL-1",
"ipv4": "195.15.0.73",
"privateIpv4": "10.0.0.5",
"tags": [
"production",
"web"
],
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-15T10:05:00Z"
}
]
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}