Create DNAT rules in batches
Updated at:2025-10-16
Create DNAT rules in batches
Description
Create DNAT rules for the NAT gateway in batch
Request structure
Plain Text
1POST /v{version}/nat/{natId}/dnatRule/batchCreate?clientToken={clientToken} HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4{
5 "rules": [
6 {
7 "ruleName":"test1",
8 "publicIpAddress":"100.88.14.90",
9 "privateIpAddress":"192.168.1.1",
10 "protocol":"TCP",
11 "publicPort":1212,
12 "privatePort":1212
13 },
14 {
15 "ruleName":"test2",
16 "publicIpAddress":"100.88.14.52",
17 "privateIpAddress":"192.168.1.2",
18 "protocol":"UDP",
19 "publicPort":65535,
20 "privatePort":65535
21 }
22 ]
23}
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number, current value is 1. |
| clientToken | String | Yes | Query | Idempotence token, which is an ASCII string with a length not exceeding 64 bits, see details in [ClientToken Idempotence Support](VPC/API Reference/General Description.md) |
| natId | String | Yes | URL parameter | NAT gateway ID |
| rules | List<[DnatRuleRequest](VPC/API Reference/Appendix.md#DnatRuleRequest)> | Yes | RequestBody | DNAT rule set |
Response headers
No special headers are required beyond the standard ones.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| ruleIds | List |
Collection of IDs of the created DNAT rules |
Request example
Plain Text
1POST /v1/nat/nat-brkztytqzbh0/dnatRule/batchCreate?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
2Host: bcc.bj.baidubce.com
3ContentType: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2018-07-05T04:17:29Z/3600/ host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
5{
6 "rules": [
7 {
8 "ruleName":"test1",
9 "publicIpAddress":"100.88.14.90",
10 "privateIpAddress":"192.168.1.1",
11 "protocol":"TCP",
12 "publicPort":1212,
13 "privatePort":1212
14 },
15 {
16 "ruleName":"test2",
17 "publicIpAddress":"100.88.14.52",
18 "privateIpAddress":"192.168.1.2",
19 "protocol":"UDP",
20 "publicPort":65535,
21 "privatePort":65535
22 }
23 ]
24}
Response example
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: Fri, 06 July 2018 07:06:06 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS
6{
7 "ruleIds": [
8 "rule-zrsaybxm7nrn",
9 "rule-f5kid5g50nua"
10 ]
11}
