Update instance
curl --request PUT \
--url https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "my-host"
},
"spec": {
"flavorId": "c7568e2d-f9ab-453d-9a3a-51375f78426b",
"imageId": "a10e30e8-006a-48e6-a3c7-3c9416891f31",
"networking": {
"securityGroups": [
"dd5954af-1d71-4abf-bb16-5729c7163886"
]
}
}
}
'import requests
url = "https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}"
payload = {
"metadata": { "name": "my-host" },
"spec": {
"flavorId": "c7568e2d-f9ab-453d-9a3a-51375f78426b",
"imageId": "a10e30e8-006a-48e6-a3c7-3c9416891f31",
"networking": { "securityGroups": ["dd5954af-1d71-4abf-bb16-5729c7163886"] }
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {name: 'my-host'},
spec: {
flavorId: 'c7568e2d-f9ab-453d-9a3a-51375f78426b',
imageId: 'a10e30e8-006a-48e6-a3c7-3c9416891f31',
networking: {securityGroups: ['dd5954af-1d71-4abf-bb16-5729c7163886']}
}
})
};
fetch('https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}', 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://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'name' => 'my-host'
],
'spec' => [
'flavorId' => 'c7568e2d-f9ab-453d-9a3a-51375f78426b',
'imageId' => 'a10e30e8-006a-48e6-a3c7-3c9416891f31',
'networking' => [
'securityGroups' => [
'dd5954af-1d71-4abf-bb16-5729c7163886'
]
]
]
]),
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://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"flavorId\": \"c7568e2d-f9ab-453d-9a3a-51375f78426b\",\n \"imageId\": \"a10e30e8-006a-48e6-a3c7-3c9416891f31\",\n \"networking\": {\n \"securityGroups\": [\n \"dd5954af-1d71-4abf-bb16-5729c7163886\"\n ]\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"flavorId\": \"c7568e2d-f9ab-453d-9a3a-51375f78426b\",\n \"imageId\": \"a10e30e8-006a-48e6-a3c7-3c9416891f31\",\n \"networking\": {\n \"securityGroups\": [\n \"dd5954af-1d71-4abf-bb16-5729c7163886\"\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"flavorId\": \"c7568e2d-f9ab-453d-9a3a-51375f78426b\",\n \"imageId\": \"a10e30e8-006a-48e6-a3c7-3c9416891f31\",\n \"networking\": {\n \"securityGroups\": [\n \"dd5954af-1d71-4abf-bb16-5729c7163886\"\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "c7568e2d-f9ab-453d-9a3a-51375f78426b",
"name": "my-host",
"organizationId": "d4600d6e-e965-4b44-a808-84fb2fa36702",
"projectId": "cae219d7-10e5-4601-8c2c-ee7e066b93ce",
"creationTime": "2023-07-31T10:45:45Z",
"provisioningStatus": "provisioned",
"healthStatus": "healthy"
},
"spec": {
"flavorId": "c7568e2d-f9ab-453d-9a3a-51375f78426b",
"imageId": "a10e30e8-006a-48e6-a3c7-3c9416891f31",
"networking": {
"publicIP": true,
"securityGroups": [
"dd5954af-1d71-4abf-bb16-5729c7163886"
]
}
},
"status": {
"regionId": "bb518c64-6856-4d67-a799-314ba668649f",
"networkId": "b059b3e6-9ae5-42b7-94b4-f42fb7a6baee",
"privateIP": "192.168.0.3",
"publicIP": "183.45.68.162",
"powerState": "Running"
}
}{
"error": "invalid_request",
"error_description": "request body invalid"
}{
"error": "access_denied",
"error_description": "authentication failed"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges"
}{
"error": "not_found",
"error_description": "the requested resource does not exist"
}{
"error": "server_error",
"error_description": "failed to token claim"
}Instances
Update instance
Update an instance.
PUT
/
api
/
v2
/
instances
/
{instanceID}
Update instance
curl --request PUT \
--url https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "my-host"
},
"spec": {
"flavorId": "c7568e2d-f9ab-453d-9a3a-51375f78426b",
"imageId": "a10e30e8-006a-48e6-a3c7-3c9416891f31",
"networking": {
"securityGroups": [
"dd5954af-1d71-4abf-bb16-5729c7163886"
]
}
}
}
'import requests
url = "https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}"
payload = {
"metadata": { "name": "my-host" },
"spec": {
"flavorId": "c7568e2d-f9ab-453d-9a3a-51375f78426b",
"imageId": "a10e30e8-006a-48e6-a3c7-3c9416891f31",
"networking": { "securityGroups": ["dd5954af-1d71-4abf-bb16-5729c7163886"] }
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {name: 'my-host'},
spec: {
flavorId: 'c7568e2d-f9ab-453d-9a3a-51375f78426b',
imageId: 'a10e30e8-006a-48e6-a3c7-3c9416891f31',
networking: {securityGroups: ['dd5954af-1d71-4abf-bb16-5729c7163886']}
}
})
};
fetch('https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}', 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://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'name' => 'my-host'
],
'spec' => [
'flavorId' => 'c7568e2d-f9ab-453d-9a3a-51375f78426b',
'imageId' => 'a10e30e8-006a-48e6-a3c7-3c9416891f31',
'networking' => [
'securityGroups' => [
'dd5954af-1d71-4abf-bb16-5729c7163886'
]
]
]
]),
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://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"flavorId\": \"c7568e2d-f9ab-453d-9a3a-51375f78426b\",\n \"imageId\": \"a10e30e8-006a-48e6-a3c7-3c9416891f31\",\n \"networking\": {\n \"securityGroups\": [\n \"dd5954af-1d71-4abf-bb16-5729c7163886\"\n ]\n }\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"flavorId\": \"c7568e2d-f9ab-453d-9a3a-51375f78426b\",\n \"imageId\": \"a10e30e8-006a-48e6-a3c7-3c9416891f31\",\n \"networking\": {\n \"securityGroups\": [\n \"dd5954af-1d71-4abf-bb16-5729c7163886\"\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://compute.nks.europe-west4.nscale.com/api/v2/instances/{instanceID}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"flavorId\": \"c7568e2d-f9ab-453d-9a3a-51375f78426b\",\n \"imageId\": \"a10e30e8-006a-48e6-a3c7-3c9416891f31\",\n \"networking\": {\n \"securityGroups\": [\n \"dd5954af-1d71-4abf-bb16-5729c7163886\"\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "c7568e2d-f9ab-453d-9a3a-51375f78426b",
"name": "my-host",
"organizationId": "d4600d6e-e965-4b44-a808-84fb2fa36702",
"projectId": "cae219d7-10e5-4601-8c2c-ee7e066b93ce",
"creationTime": "2023-07-31T10:45:45Z",
"provisioningStatus": "provisioned",
"healthStatus": "healthy"
},
"spec": {
"flavorId": "c7568e2d-f9ab-453d-9a3a-51375f78426b",
"imageId": "a10e30e8-006a-48e6-a3c7-3c9416891f31",
"networking": {
"publicIP": true,
"securityGroups": [
"dd5954af-1d71-4abf-bb16-5729c7163886"
]
}
},
"status": {
"regionId": "bb518c64-6856-4d67-a799-314ba668649f",
"networkId": "b059b3e6-9ae5-42b7-94b4-f42fb7a6baee",
"privateIP": "192.168.0.3",
"publicIP": "183.45.68.162",
"powerState": "Running"
}
}{
"error": "invalid_request",
"error_description": "request body invalid"
}{
"error": "access_denied",
"error_description": "authentication failed"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges"
}{
"error": "not_found",
"error_description": "the requested resource does not exist"
}{
"error": "server_error",
"error_description": "failed to token claim"
}Authorizations
Operation requires OAuth 2.0 bearer token authentication.
Path Parameters
The instance ID. A Kubernetes name. Must be a valid DNS containing only lower case characters, numbers or hyphens, start and end with a character or number, and be at most 63 characters in length.
Required string length:
1 - 63Body
application/json
A compute instance update request.
Was this page helpful?
⌘I