i1wan
Enthusiast
Enthusiast

ISSUE: placing an "edge" firewall rule with REST API above another one... (not working)

Hi,

I just created an (edge) firewall rule with REST API:

  POSThttps://<nsx-manager-ip>/api/4.0/edges/edge-5/firewall/config/rules

<firewallRules>

    <firewallRule>

        <name>rule1</name>

        <ruleType>user</ruleType>

        <enabled>true</enabled>

        <loggingEnabled>false</loggingEnabled>

        <action>accept</action>

        <source>any</source>

        <destination>any</destination>

    </firewallRule>

</firewallRules>

I now want to create ANOTHER rule and place this ABOVE the rule I just created...

But somehow if I do that with the correct REST API link syntax it palaces this other rule BELOW the first rule that I created.

POSThttps://<nsx-manager-ip>/api/4.0/edges/edge-5/firewall/config/rules?aboveruleid=133124

<firewallRules>

    <firewallRule>

        <name>rule0</name>

        <ruleType>user</ruleType>

        <enabled>true</enabled>

        <loggingEnabled>false</loggingEnabled>

        <action>accept</action>

        <source>any</source>

        <destination>any</destination>

    </firewallRule>

</firewallRules>

What am I doing wrong here?

0 Kudos
1 Reply
2cool2touch
Contributor
Contributor

Don't use the <firewallRules></firewallRules> tag. Only use the <firewallRule></firewallRule> tag. For add above a ruleId, adding only one rule at a time is allowed.

ALSO, your URL has aboveruleid which should be aboveRuleId. The URL is caseSensitive 🙂

 

HTH

0 Kudos