2 Replies Latest reply on Jun 6, 2019 6:35 AM by Czernobog

    Unable to add new App Firewall Rule using REST API call to vCNS 5.1

    globalhawk Novice

      I am trying to add some new App Firewall rules to vCNS 5.1

       

      These are the following code. But I keep getting this error message "The remote server returned an error: (412) Precondition Failed.". Any help ?

       

      TestRule2 is the new rule that i am trying to add.

       

      Request Header has generationNumber added as If-Match

       

      Request Body

      POST https://vcns-ip/api/2.0/app/firewall/mycontextid/config

       

      <?xml version="1.0" encoding="UTF-8"?>

      <VshieldAppConfiguration>

        <firewallConfiguration contextId="datacenter-2" generationNumber="1394666438168" provisioned="true">

          <layer3FirewallRule id="0" precedence="none" disabled="false">

            <name>TestRule2</name>

            <action>allow</action>

            <logged>false</logged>

            <notes /><source>

            <address exclude="false" />

            <portInfo />

            </source>

          </layer3FirewallRule>

          <layer3FirewallRule id="1002" precedence="default" disabled="false">

            <name>Default Rule</name>

            <action>allow</action>

            <logged>false</logged>

            <notes />

          </layer3FirewallRule>

          <layer2FirewallRule id="1001" precedence="default" disabled="false">

            <name>Default Rule</name>

            <action>allow</action>

            <logged>false</logged>

            <notes />

          </layer2FirewallRule>

        </firewallConfiguration>

      </VshieldAppConfiguration>