Available in VPC
Add a route to a route table.Request
This section describes the request format. The method and URI are as follows:
| Method | URI |
|---|---|
| GET | POST | /vpc/v2/addRoute |
Note
This guide is based on the GET method. POST method call tests can be performed through Swagger in the API Gateway service of the NAVER Cloud Platform console.
Request headers
For information about the headers common to all VPC APIs, see VPC common headers.
Request query parameters
You can use the following query parameters with your request:
| Field | Type | Required | Description |
|---|---|---|---|
regionCode |
String | Optional | Region code of the route table to which you want to add the route
|
vpcNo |
String | Required | VPC number of the route table
|
routeTableNo |
String | Required | Route table number
|
routeList.N.destinationCidrBlock |
String | Required | Destination IPv4 address range of the route to add
|
routeList.N.targetTypeCode |
String | Required | Destination type of the route to add
|
routeList.N.targetNo |
String | Required | Destination identification number of the route to add
|
routeList.N.targetName |
String | Required | Destination name of the route to add
|
responseFormatType |
String | Optional | Format of the response result
|
Request example
The request example is as follows:
curl --location 'https://ncloud.apigw.ntruss.com/vpc/v2/addRoute
?regionCode=KR
&vpcNo=***04
&routeTableNo=***38
&routeList.1.destinationCidrBlock=***.***.200.0/24
&routeList.1.targetTypeCode=NATGW
&routeList.1.targetNo=***9734
&routeList.1.targetName=test-***' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}'
Response
This section describes the response format.
Response body
See RouteList for the response body.
Response status codes
For information about the HTTP status codes common to all VPC APIs, see VPC response status codes.
Response example
The response example is as follows:
<addRouteResponse>
<requestId>2b97f2f0-39fc-40f0-9a8d-3eb6d40506e3</requestId>
<returnCode>0</returnCode>
<returnMessage>success</returnMessage>
<totalRows>3</totalRows>
<routeList>
<route>
<destinationCidrBlock>***.***.200.0/24</destinationCidrBlock>
<targetName>test-***</targetName>
<routeTableNo>***38</routeTableNo>
<targetType>
<code>NATGW</code>
<codeName>NAT Gateway</codeName>
</targetType>
<targetNo>***9734</targetNo>
<isDefault>false</isDefault>
</route>
<route>
<destinationCidrBlock>***.***.0.0/16</destinationCidrBlock>
<targetName>LOCAL</targetName>
<routeTableNo>***38</routeTableNo>
<targetType>
<code>LOCAL</code>
<codeName>Local</codeName>
</targetType>
<targetNo></targetNo>
<isDefault>true</isDefault>
</route>
<route>
<destinationCidrBlock>***.***.0.0/0</destinationCidrBlock>
<targetName>INTERNET GATEWAY</targetName>
<routeTableNo>***38</routeTableNo>
<targetType>
<code>IGW</code>
<codeName>Internet Gateway</codeName>
</targetType>
<targetNo></targetNo>
<isDefault>true</isDefault>
</route>
</routeList>
</addRouteResponse>