Update network
curl --request PUT \
--url https://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "network-name",
"description": "A verbose description",
"tags": [
{
"name": "cluster-id",
"value": "9361402c-f998-49cc-ab21-9bb99afcfde8"
}
]
},
"spec": {
"dnsNameservers": [
"8.8.8.8"
],
"routes": [
{
"prefix": "10.0.0.0/8",
"nexthop": "192.168.0.10"
}
]
}
}
'import requests
url = "https://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}"
payload = {
"metadata": {
"name": "network-name",
"description": "A verbose description",
"tags": [
{
"name": "cluster-id",
"value": "9361402c-f998-49cc-ab21-9bb99afcfde8"
}
]
},
"spec": {
"dnsNameservers": ["8.8.8.8"],
"routes": [
{
"prefix": "10.0.0.0/8",
"nexthop": "192.168.0.10"
}
]
}
}
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: 'network-name',
description: 'A verbose description',
tags: [{name: 'cluster-id', value: '9361402c-f998-49cc-ab21-9bb99afcfde8'}]
},
spec: {
dnsNameservers: ['8.8.8.8'],
routes: [{prefix: '10.0.0.0/8', nexthop: '192.168.0.10'}]
}
})
};
fetch('https://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}', 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://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}",
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' => 'network-name',
'description' => 'A verbose description',
'tags' => [
[
'name' => 'cluster-id',
'value' => '9361402c-f998-49cc-ab21-9bb99afcfde8'
]
]
],
'spec' => [
'dnsNameservers' => [
'8.8.8.8'
],
'routes' => [
[
'prefix' => '10.0.0.0/8',
'nexthop' => '192.168.0.10'
]
]
]
]),
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://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"network-name\",\n \"description\": \"A verbose description\",\n \"tags\": [\n {\n \"name\": \"cluster-id\",\n \"value\": \"9361402c-f998-49cc-ab21-9bb99afcfde8\"\n }\n ]\n },\n \"spec\": {\n \"dnsNameservers\": [\n \"8.8.8.8\"\n ],\n \"routes\": [\n {\n \"prefix\": \"10.0.0.0/8\",\n \"nexthop\": \"192.168.0.10\"\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://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"network-name\",\n \"description\": \"A verbose description\",\n \"tags\": [\n {\n \"name\": \"cluster-id\",\n \"value\": \"9361402c-f998-49cc-ab21-9bb99afcfde8\"\n }\n ]\n },\n \"spec\": {\n \"dnsNameservers\": [\n \"8.8.8.8\"\n ],\n \"routes\": [\n {\n \"prefix\": \"10.0.0.0/8\",\n \"nexthop\": \"192.168.0.10\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}")
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\": \"network-name\",\n \"description\": \"A verbose description\",\n \"tags\": [\n {\n \"name\": \"cluster-id\",\n \"value\": \"9361402c-f998-49cc-ab21-9bb99afcfde8\"\n }\n ]\n },\n \"spec\": {\n \"dnsNameservers\": [\n \"8.8.8.8\"\n ],\n \"routes\": [\n {\n \"prefix\": \"10.0.0.0/8\",\n \"nexthop\": \"192.168.0.10\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "a64f9269-36e0-4312-b8d1-52d93d569b7b",
"name": "my-network",
"organizationId": "9a8c6370-4065-4d4a-9da0-7678df40cd9d",
"projectId": "e36c058a-8eba-4f5b-91f4-f6ffb983795c",
"creationTime": "2024-05-31T14:11:00Z",
"createdBy": "john.doe@acme.com",
"provisioningStatus": "provisioned",
"healthStatus": "healthy"
},
"spec": {
"dnsNameservers": [
"8.8.8.8"
]
},
"status": {
"regionId": "d891dbf0-0a01-4efc-ae3a-5d77f6d3424b",
"prefix": "192.168.0.0/24",
"reservations": {
"prefixLength": 25,
"providerReservedPrefixLength": 28
}
}
}{
"error": "invalid_request",
"error_description": "request body invalid",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "access_denied",
"error_description": "authentication failed",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "not_found",
"error_description": "the requested resource does not exist",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "conflict",
"error_description": "a resource with the same name already exists",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "unprocessable_content",
"error_description": "the request body was in the wrong format",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "server_error",
"error_description": "failed to token claim",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}Networks
Update network
Update a network’s mutable fields.
PUT
/
api
/
v2
/
networks
/
{networkID}
Update network
curl --request PUT \
--url https://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"name": "network-name",
"description": "A verbose description",
"tags": [
{
"name": "cluster-id",
"value": "9361402c-f998-49cc-ab21-9bb99afcfde8"
}
]
},
"spec": {
"dnsNameservers": [
"8.8.8.8"
],
"routes": [
{
"prefix": "10.0.0.0/8",
"nexthop": "192.168.0.10"
}
]
}
}
'import requests
url = "https://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}"
payload = {
"metadata": {
"name": "network-name",
"description": "A verbose description",
"tags": [
{
"name": "cluster-id",
"value": "9361402c-f998-49cc-ab21-9bb99afcfde8"
}
]
},
"spec": {
"dnsNameservers": ["8.8.8.8"],
"routes": [
{
"prefix": "10.0.0.0/8",
"nexthop": "192.168.0.10"
}
]
}
}
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: 'network-name',
description: 'A verbose description',
tags: [{name: 'cluster-id', value: '9361402c-f998-49cc-ab21-9bb99afcfde8'}]
},
spec: {
dnsNameservers: ['8.8.8.8'],
routes: [{prefix: '10.0.0.0/8', nexthop: '192.168.0.10'}]
}
})
};
fetch('https://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}', 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://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}",
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' => 'network-name',
'description' => 'A verbose description',
'tags' => [
[
'name' => 'cluster-id',
'value' => '9361402c-f998-49cc-ab21-9bb99afcfde8'
]
]
],
'spec' => [
'dnsNameservers' => [
'8.8.8.8'
],
'routes' => [
[
'prefix' => '10.0.0.0/8',
'nexthop' => '192.168.0.10'
]
]
]
]),
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://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}"
payload := strings.NewReader("{\n \"metadata\": {\n \"name\": \"network-name\",\n \"description\": \"A verbose description\",\n \"tags\": [\n {\n \"name\": \"cluster-id\",\n \"value\": \"9361402c-f998-49cc-ab21-9bb99afcfde8\"\n }\n ]\n },\n \"spec\": {\n \"dnsNameservers\": [\n \"8.8.8.8\"\n ],\n \"routes\": [\n {\n \"prefix\": \"10.0.0.0/8\",\n \"nexthop\": \"192.168.0.10\"\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://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metadata\": {\n \"name\": \"network-name\",\n \"description\": \"A verbose description\",\n \"tags\": [\n {\n \"name\": \"cluster-id\",\n \"value\": \"9361402c-f998-49cc-ab21-9bb99afcfde8\"\n }\n ]\n },\n \"spec\": {\n \"dnsNameservers\": [\n \"8.8.8.8\"\n ],\n \"routes\": [\n {\n \"prefix\": \"10.0.0.0/8\",\n \"nexthop\": \"192.168.0.10\"\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://region.nks.europe-west4.nscale.com/api/v2/networks/{networkID}")
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\": \"network-name\",\n \"description\": \"A verbose description\",\n \"tags\": [\n {\n \"name\": \"cluster-id\",\n \"value\": \"9361402c-f998-49cc-ab21-9bb99afcfde8\"\n }\n ]\n },\n \"spec\": {\n \"dnsNameservers\": [\n \"8.8.8.8\"\n ],\n \"routes\": [\n {\n \"prefix\": \"10.0.0.0/8\",\n \"nexthop\": \"192.168.0.10\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"metadata": {
"id": "a64f9269-36e0-4312-b8d1-52d93d569b7b",
"name": "my-network",
"organizationId": "9a8c6370-4065-4d4a-9da0-7678df40cd9d",
"projectId": "e36c058a-8eba-4f5b-91f4-f6ffb983795c",
"creationTime": "2024-05-31T14:11:00Z",
"createdBy": "john.doe@acme.com",
"provisioningStatus": "provisioned",
"healthStatus": "healthy"
},
"spec": {
"dnsNameservers": [
"8.8.8.8"
]
},
"status": {
"regionId": "d891dbf0-0a01-4efc-ae3a-5d77f6d3424b",
"prefix": "192.168.0.0/24",
"reservations": {
"prefixLength": 25,
"providerReservedPrefixLength": 28
}
}
}{
"error": "invalid_request",
"error_description": "request body invalid",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "access_denied",
"error_description": "authentication failed",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "forbidden",
"error_description": "user credentials do not have the required privileges",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "not_found",
"error_description": "the requested resource does not exist",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "conflict",
"error_description": "a resource with the same name already exists",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "unprocessable_content",
"error_description": "the request body was in the wrong format",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}{
"error": "server_error",
"error_description": "failed to token claim",
"trace_id": "57bc14d9bd461f0b5a72db830149b67a"
}Authorizations
Operation requires OAuth 2.0 bearer token authentication.
Path Parameters
The network ID. A network ID.
Body
application/json
A request for a network create.
Was this page helpful?
⌘I