tencent cloud

文档反馈

CreateRoutes

最后更新时间:2023-08-18 15:47:44

1. API Description

Domain name for API request: ecm.tencentcloudapi.com.

This API is used to create a routing policy.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateRoutes.
Version Yes String Common Params. The value used for this API: 2019-07-19.
Region No String Common Params. This parameter is not required for this API.
RouteTableId Yes String Route table instance ID.
Routes.N Yes Array of Route Routing policy object to be created.

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Number of added instances.
RouteTableSet Array of RouteTable Route table object.
Note: this field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating routing policy

Input Example

https://ecm.tencentcloudapi.com/?Action=CreateRoutes
&RouteTableId=rtb-n0yejvje
&Routes.0.DestinationCidrBlock=192.168.0.0/16
&Routes.0.GatewayType=NORMAL_CVM
&Routes.0.GatewayId=10.212.0.13
&Routes.0.RouteDescription=TEST-ROUTE
&<Common request parameters>

Output Example

{
    "Response": {
        "RouteTableSet": [
            {
                "VpcId": "vpc-k23blx7p",
                "RouteTableId": "rtb-n0yejvje",
                "RouteTableName": "TestRoutes",
                "AssociationSet": [],
                "RouteSet": [
                    {
                        "RouteItemId": "rti-12345678",
                        "DestinationCidrBlock": "192.168.0.0/16",
                        "GatewayType": "NORMAL_CVM",
                        "GatewayId": "10.212.0.13",
                        "RouteDescription": "TEST-ROUTE"
                    }
                ],
                "Main": false,
                "CreatedTime": "2020-11-11 11:11:03"
            }
        ],
        "TotalCount": 1,
        "RequestId": "3f934a21-2786-44af-a421-38ee6c6e1fae"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InvalidParameter.InvalidDataFormat The data format is incorrect.
InvalidParameterValue The parameter value is incorrect.
InvalidParameterValue.CidrNotInPeerVpc The destination IP range is not within the CIDR range of the customer VPC.
InvalidParameterValue.Duplicate The data is duplicate.
InvalidParameterValue.InvalidRegion The ECM region is invalid.
InvalidParameterValue.Malformed The input parameter format is invalid.
InvalidParameterValue.VpcCidrConflict The destination IP range conflicts with the CIDR block of the current VPC.
LimitExceeded The quota limit is exceeded.
ResourceNotFound The resource does not exist.
UnsupportedOperation Unsupported operation.
UnsupportedOperation.Ecmp The ECMP is not supported.
UnsupportedOperation.EcmpWithCcnRoute ECMP was formed with the CCN route.
UnsupportedOperation.EcmpWithUserRoute ECMP was formed with the custom route.
UnsupportedOperation.SystemRoute Operations on the system route are prohibited.