Create instance
curl --request POST \
--url https://compute.nks.europe-west4.nscale.com/api/v2/instances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "my-host"
},
"spec": {
"organizationId": "d4600d6e-e965-4b44-a808-84fb2fa36702",
"projectId": "cae219d7-10e5-4601-8c2c-ee7e066b93ce",
"networkId": "b059b3e6-9ae5-42b7-94b4-f42fb7a6baee",
"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"
payload = {
"metadata": { "name": "my-host" },
"spec": {
"organizationId": "d4600d6e-e965-4b44-a808-84fb2fa36702",
"projectId": "cae219d7-10e5-4601-8c2c-ee7e066b93ce",
"networkId": "b059b3e6-9ae5-42b7-94b4-f42fb7a6baee",
"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.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {name: 'my-host'},
spec: {
organizationId: 'd4600d6e-e965-4b44-a808-84fb2fa36702',
projectId: 'cae219d7-10e5-4601-8c2c-ee7e066b93ce',
networkId: 'b059b3e6-9ae5-42b7-94b4-f42fb7a6baee',
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', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'name' => 'my-host'
],
'spec' => [
'organizationId' => 'd4600d6e-e965-4b44-a808-84fb2fa36702',
'projectId' => 'cae219d7-10e5-4601-8c2c-ee7e066b93ce',
'networkId' => 'b059b3e6-9ae5-42b7-94b4-f42fb7a6baee',
'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"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"organizationId\": \"d4600d6e-e965-4b44-a808-84fb2fa36702\",\n \"projectId\": \"cae219d7-10e5-4601-8c2c-ee7e066b93ce\",\n \"networkId\": \"b059b3e6-9ae5-42b7-94b4-f42fb7a6baee\",\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("POST", 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.post("https://compute.nks.europe-west4.nscale.com/api/v2/instances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"organizationId\": \"d4600d6e-e965-4b44-a808-84fb2fa36702\",\n \"projectId\": \"cae219d7-10e5-4601-8c2c-ee7e066b93ce\",\n \"networkId\": \"b059b3e6-9ae5-42b7-94b4-f42fb7a6baee\",\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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"organizationId\": \"d4600d6e-e965-4b44-a808-84fb2fa36702\",\n \"projectId\": \"cae219d7-10e5-4601-8c2c-ee7e066b93ce\",\n \"networkId\": \"b059b3e6-9ae5-42b7-94b4-f42fb7a6baee\",\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": "server_error",
"error_description": "failed to token claim"
}Instances
Create instance
Create an instance.
POST
/
api
/
v2
/
instances
Create instance
curl --request POST \
--url https://compute.nks.europe-west4.nscale.com/api/v2/instances \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "my-host"
},
"spec": {
"organizationId": "d4600d6e-e965-4b44-a808-84fb2fa36702",
"projectId": "cae219d7-10e5-4601-8c2c-ee7e066b93ce",
"networkId": "b059b3e6-9ae5-42b7-94b4-f42fb7a6baee",
"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"
payload = {
"metadata": { "name": "my-host" },
"spec": {
"organizationId": "d4600d6e-e965-4b44-a808-84fb2fa36702",
"projectId": "cae219d7-10e5-4601-8c2c-ee7e066b93ce",
"networkId": "b059b3e6-9ae5-42b7-94b4-f42fb7a6baee",
"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.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metadata: {name: 'my-host'},
spec: {
organizationId: 'd4600d6e-e965-4b44-a808-84fb2fa36702',
projectId: 'cae219d7-10e5-4601-8c2c-ee7e066b93ce',
networkId: 'b059b3e6-9ae5-42b7-94b4-f42fb7a6baee',
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', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'metadata' => [
'name' => 'my-host'
],
'spec' => [
'organizationId' => 'd4600d6e-e965-4b44-a808-84fb2fa36702',
'projectId' => 'cae219d7-10e5-4601-8c2c-ee7e066b93ce',
'networkId' => 'b059b3e6-9ae5-42b7-94b4-f42fb7a6baee',
'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"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"organizationId\": \"d4600d6e-e965-4b44-a808-84fb2fa36702\",\n \"projectId\": \"cae219d7-10e5-4601-8c2c-ee7e066b93ce\",\n \"networkId\": \"b059b3e6-9ae5-42b7-94b4-f42fb7a6baee\",\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("POST", 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.post("https://compute.nks.europe-west4.nscale.com/api/v2/instances")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"organizationId\": \"d4600d6e-e965-4b44-a808-84fb2fa36702\",\n \"projectId\": \"cae219d7-10e5-4601-8c2c-ee7e066b93ce\",\n \"networkId\": \"b059b3e6-9ae5-42b7-94b4-f42fb7a6baee\",\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")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metadata\": {\n \"name\": \"my-host\"\n },\n \"spec\": {\n \"organizationId\": \"d4600d6e-e965-4b44-a808-84fb2fa36702\",\n \"projectId\": \"cae219d7-10e5-4601-8c2c-ee7e066b93ce\",\n \"networkId\": \"b059b3e6-9ae5-42b7-94b4-f42fb7a6baee\",\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": "server_error",
"error_description": "failed to token claim"
}Authorizations
Operation requires OAuth 2.0 bearer token authentication.
Body
application/json
A compute instance creation request.
Was this page helpful?
⌘I