curl --request PATCH \
--url https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"external_gateway_info": {
"enable_snat": false,
"network_id": "d7745dcf-b302-4795-9d61-6cc52487af48",
"type": "manual"
},
"name": "my_renamed_router",
"routes": [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
]
}
'import requests
url = "https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}"
payload = {
"external_gateway_info": {
"enable_snat": False,
"network_id": "d7745dcf-b302-4795-9d61-6cc52487af48",
"type": "manual"
},
"name": "my_renamed_router",
"routes": [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_gateway_info: {
enable_snat: false,
network_id: 'd7745dcf-b302-4795-9d61-6cc52487af48',
type: 'manual'
},
name: 'my_renamed_router',
routes: [{destination: '10.0.3.0/24', nexthop: '10.0.0.13'}]
})
};
fetch('https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_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.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_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([
'external_gateway_info' => [
'enable_snat' => false,
'network_id' => 'd7745dcf-b302-4795-9d61-6cc52487af48',
'type' => 'manual'
],
'name' => 'my_renamed_router',
'routes' => [
[
'destination' => '10.0.3.0/24',
'nexthop' => '10.0.0.13'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}"
payload := strings.NewReader("{\n \"external_gateway_info\": {\n \"enable_snat\": false,\n \"network_id\": \"d7745dcf-b302-4795-9d61-6cc52487af48\",\n \"type\": \"manual\"\n },\n \"name\": \"my_renamed_router\",\n \"routes\": [\n {\n \"destination\": \"10.0.3.0/24\",\n \"nexthop\": \"10.0.0.13\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_gateway_info\": {\n \"enable_snat\": false,\n \"network_id\": \"d7745dcf-b302-4795-9d61-6cc52487af48\",\n \"type\": \"manual\"\n },\n \"name\": \"my_renamed_router\",\n \"routes\": [\n {\n \"destination\": \"10.0.3.0/24\",\n \"nexthop\": \"10.0.0.13\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_gateway_info\": {\n \"enable_snat\": false,\n \"network_id\": \"d7745dcf-b302-4795-9d61-6cc52487af48\",\n \"type\": \"manual\"\n },\n \"name\": \"my_renamed_router\",\n \"routes\": [\n {\n \"destination\": \"10.0.3.0/24\",\n \"nexthop\": \"10.0.0.13\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"distributed": true,
"id": "<string>",
"interfaces": [
{
"ip_assignments": [
{
"ip_address": "192.168.123.20",
"subnet_id": "351b0dd7-ca09-431c-be53-935db3785067"
},
{
"ip_address": "192.168.120.16",
"subnet_id": "0a641ef8-62dc-4146-91e5-6ab4b464df6d"
}
],
"network_id": "bc688791-f1b0-44eb-97d4-07697294b1e1",
"port_id": "1f0ca628-a73b-42c0-bdac-7b10d023e097",
"mac_address": "00:16:3e:f2:87:16"
}
],
"name": "<string>",
"project_id": 1337,
"region": "Luxembourg 1",
"region_id": 7,
"routes": [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
],
"status": "<string>",
"task_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"creator_task_id": "<string>",
"external_gateway_info": {
"enable_snat": true,
"external_fixed_ips": [
{
"ip_address": "172.24.4.6",
"subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
}
],
"network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
}
}Update router
Update the configuration of an existing router.
Deprecated: Use PATCH /v2/routers/{project_id}/{region_id}/{router_id} instead.
curl --request PATCH \
--url https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"external_gateway_info": {
"enable_snat": false,
"network_id": "d7745dcf-b302-4795-9d61-6cc52487af48",
"type": "manual"
},
"name": "my_renamed_router",
"routes": [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
]
}
'import requests
url = "https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}"
payload = {
"external_gateway_info": {
"enable_snat": False,
"network_id": "d7745dcf-b302-4795-9d61-6cc52487af48",
"type": "manual"
},
"name": "my_renamed_router",
"routes": [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_gateway_info: {
enable_snat: false,
network_id: 'd7745dcf-b302-4795-9d61-6cc52487af48',
type: 'manual'
},
name: 'my_renamed_router',
routes: [{destination: '10.0.3.0/24', nexthop: '10.0.0.13'}]
})
};
fetch('https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_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.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_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([
'external_gateway_info' => [
'enable_snat' => false,
'network_id' => 'd7745dcf-b302-4795-9d61-6cc52487af48',
'type' => 'manual'
],
'name' => 'my_renamed_router',
'routes' => [
[
'destination' => '10.0.3.0/24',
'nexthop' => '10.0.0.13'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}"
payload := strings.NewReader("{\n \"external_gateway_info\": {\n \"enable_snat\": false,\n \"network_id\": \"d7745dcf-b302-4795-9d61-6cc52487af48\",\n \"type\": \"manual\"\n },\n \"name\": \"my_renamed_router\",\n \"routes\": [\n {\n \"destination\": \"10.0.3.0/24\",\n \"nexthop\": \"10.0.0.13\"\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_gateway_info\": {\n \"enable_snat\": false,\n \"network_id\": \"d7745dcf-b302-4795-9d61-6cc52487af48\",\n \"type\": \"manual\"\n },\n \"name\": \"my_renamed_router\",\n \"routes\": [\n {\n \"destination\": \"10.0.3.0/24\",\n \"nexthop\": \"10.0.0.13\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/routers/{project_id}/{region_id}/{router_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_gateway_info\": {\n \"enable_snat\": false,\n \"network_id\": \"d7745dcf-b302-4795-9d61-6cc52487af48\",\n \"type\": \"manual\"\n },\n \"name\": \"my_renamed_router\",\n \"routes\": [\n {\n \"destination\": \"10.0.3.0/24\",\n \"nexthop\": \"10.0.0.13\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2023-11-07T05:31:56Z",
"distributed": true,
"id": "<string>",
"interfaces": [
{
"ip_assignments": [
{
"ip_address": "192.168.123.20",
"subnet_id": "351b0dd7-ca09-431c-be53-935db3785067"
},
{
"ip_address": "192.168.120.16",
"subnet_id": "0a641ef8-62dc-4146-91e5-6ab4b464df6d"
}
],
"network_id": "bc688791-f1b0-44eb-97d4-07697294b1e1",
"port_id": "1f0ca628-a73b-42c0-bdac-7b10d023e097",
"mac_address": "00:16:3e:f2:87:16"
}
],
"name": "<string>",
"project_id": 1337,
"region": "Luxembourg 1",
"region_id": 7,
"routes": [
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
],
"status": "<string>",
"task_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"creator_task_id": "<string>",
"external_gateway_info": {
"enable_snat": true,
"external_fixed_ips": [
{
"ip_address": "172.24.4.6",
"subnet_id": "b930d7f6-ceb7-40a0-8b81-a425dd994ccf"
}
],
"network_id": "ae34051f-aa6c-4c75-abf5-50dc9ac99ef3"
}
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
Project ID
1
Region ID
1
Router ID
"ccd5b925-e35c-4611-a511-67ab503104c8"
Body
New external gateway configuration. Only type 'manual' is accepted on update, so you must provide the network_id of the external network. Set to null to remove the external gateway.
Show child attributes
Show child attributes
{
"enable_snat": false,
"network_id": "d7745dcf-b302-4795-9d61-6cc52487af48",
"type": "manual"
}
New name of router
^[a-zA-Z0-9][a-zA-Z 0-9._\-]{1,61}[a-zA-Z0-9._]$"my_renamed_router"
List of custom routes.
Show child attributes
Show child attributes
[
{
"destination": "10.0.3.0/24",
"nexthop": "10.0.0.13"
}
]
Response
OK
Datetime when the router was created
Whether the router is distributed or centralized.
true
false
Router ID
List of router interfaces.
Show child attributes
Show child attributes
Router name
Project ID
1337
Region name
"Luxembourg 1"
Region ID
7
List of custom routes.
Show child attributes
Show child attributes
Status of the router.
The UUID of the active task that currently holds a lock on the resource. This lock prevents concurrent modifications to ensure consistency. If null, the resource is not locked.
Datetime when the router was last updated
Task that created this entity
State of this router's external gateway.
Show child attributes
Show child attributes
Was this page helpful?