Computes
Update Compute Instance
Updates a compute instance’s host name and/or tags. Both fields are optional; send only the ones you want to change, and any field you omit is left unchanged.
PATCH
/
computes
/
{id}
Update a compute instance
curl --request PATCH \
--url https://api.strettch.cloud/api/v1/computes/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hostName": "my-server-02",
"tags": [
"production",
"web"
]
}
'import requests
url = "https://api.strettch.cloud/api/v1/computes/{id}"
payload = {
"hostName": "my-server-02",
"tags": ["production", "web"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({hostName: 'my-server-02', tags: ['production', 'web']})
};
fetch('https://api.strettch.cloud/api/v1/computes/{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.strettch.cloud/api/v1/computes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'hostName' => 'my-server-02',
'tags' => [
'production',
'web'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.strettch.cloud/api/v1/computes/{id}"
payload := strings.NewReader("{\n \"hostName\": \"my-server-02\",\n \"tags\": [\n \"production\",\n \"web\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://api.strettch.cloud/api/v1/computes/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hostName\": \"my-server-02\",\n \"tags\": [\n \"production\",\n \"web\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.strettch.cloud/api/v1/computes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"hostName\": \"my-server-02\",\n \"tags\": [\n \"production\",\n \"web\"\n ]\n}"
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",
"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"
}{
"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"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}Request Reference
Both fields are optional. Send only the ones you want to change; any field you omit is left unchanged.| Field | Type | Description |
|---|---|---|
hostName | string | New host name for the compute instance. |
tags | string[] | Replacement set of tags. The list you send replaces the existing tags entirely. |
Response Error Codes
If the request fails, thecode field in the error response will contain one of the following.
- Standard
- Billing & Team
| Code | Status | Description |
|---|---|---|
BAD_REQUEST | 400 | The request was invalid or malformed. |
UNAUTHORIZED | 401 | Authentication failed or was not provided. |
FORBIDDEN | 403 | You do not have permission to perform this action. |
RESOURCE_NOT_FOUND | 404 | The specified compute instance was not found. |
INTERNAL_SERVER_ERROR | 500 | An unexpected error occurred on our end. |
These errors block all resource operations. Resolve your team’s billing status before retrying.
| Code | Status | Description |
|---|---|---|
TEAM_SUSPENDED | 403 | Team is suspended due to an outstanding payment. |
TEAM_PAST_DUE | 403 | Team has an outstanding balance that must be settled first. |
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Compute ID
Body
application/json
Was this page helpful?
⌘I
Update a compute instance
curl --request PATCH \
--url https://api.strettch.cloud/api/v1/computes/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"hostName": "my-server-02",
"tags": [
"production",
"web"
]
}
'import requests
url = "https://api.strettch.cloud/api/v1/computes/{id}"
payload = {
"hostName": "my-server-02",
"tags": ["production", "web"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({hostName: 'my-server-02', tags: ['production', 'web']})
};
fetch('https://api.strettch.cloud/api/v1/computes/{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.strettch.cloud/api/v1/computes/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'hostName' => 'my-server-02',
'tags' => [
'production',
'web'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.strettch.cloud/api/v1/computes/{id}"
payload := strings.NewReader("{\n \"hostName\": \"my-server-02\",\n \"tags\": [\n \"production\",\n \"web\"\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://api.strettch.cloud/api/v1/computes/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"hostName\": \"my-server-02\",\n \"tags\": [\n \"production\",\n \"web\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.strettch.cloud/api/v1/computes/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"hostName\": \"my-server-02\",\n \"tags\": [\n \"production\",\n \"web\"\n ]\n}"
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",
"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"
}{
"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"
}{
"code": "ERROR_CODE",
"message": "Error message description",
"requestId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"success": false,
"timestamp": "2024-01-15T10:00:00Z"
}