Management Plane API > Networking > Logical Routing And Services > NAT

Add multiple NAT rules in a specific logical router

Create multiple NAT rules in a specific logical router.
The API succeeds only when all rules are accepted and created successfully.
Any one validation voilation will fail the API, no rule will be created.
The ruleIds of each rules can be found from the responsed message.

Request:

Method:
POST
URI Path(s):
/api/v1/logical-routers/<logical-router-id>/nat/rules?action=create_multiple
Request Headers:
n/a
Query Parameters:
n/a
Request Body:
NatRuleList+

Example Request:

POST https://<nsx-mgr>/api/v1/logical-routers/1977d30c-eee2-11e4-874d-0050569c7004/nat/rules?action=create_multiple { "rules" : [ { "action": "SNAT", "match_source_network": "192.168.1.1", "translated_network": "10.117.5.19", "match_service": { "resource_type": "L4PortSetNSService", "source_ports": ["9000"], "destination_ports": ["9000"], "l4_protocol": "TCP" }, "enabled": false }, { "action": "SNAT", "match_source_network": "192.168.1.2", "translated_network": "10.117.6.88", "match_service": { "resource_type": "L4PortSetNSService", "source_ports": ["9001"], "destination_ports": ["9001"], "l4_protocol": "TCP" }, "enabled": false } ] }

Successful Response:

Response Code:
201 Created
Response Headers:
Content-type: application/json
Response Body:
NatRuleList+

Example Response:

{ "rules": [ { "resource_type": "NatRule", "id": "1029", "display_name": "01003000-0000-0405-0000-000000000018", "match_source_network": "192.168.1.1", "action": "SNAT", "logging": false, "match_service": { "resource_type": "L4PortSetNSService", "destination_ports": [ "9000" ], "l4_protocol": "TCP", "source_ports": [ "9000" ] "rule_priority": 1024, "translated_network": "10.117.5.19", "enabled": false, "firewall_match": MATCH_EXTERNAL_ADDRESS, "_last_modified_time": 1458852877750, "_create_time": 1458852877750, "_last_modified_user": "admin", "_system_owned": false, "_create_user": "admin", "_revision": 0 }, { "resource_type": "NatRule", "id": "1030", "display_name": "01003000-0000-0309-0000-000000000020", "match_source_network": "192.168.1.2", "action": "SNAT", "logging": false, "match_service": { "resource_type": "L4PortSetNSService", "destination_ports": [ "9001" ], "l4_protocol": "TCP", "source_ports": [ "9001" ] "rule_priority": 1024, "translated_network": "10.117.6.88", "enabled": false, "firewall_match": MATCH_EXTERNAL_ADDRESS, "_last_modified_time": 1458853243886, "_create_time": 1458853243886, "_last_modified_user": "admin", "_system_owned": false, "_create_user": "admin", "_revision": 0 } ] }

Required Permissions:

crud

Feature:

routing_nat

Additional Errors: