VMware NSX

 View Only
  • 1.  ISSUE: Can not create an (edge) Firewall rule with the REST API

    Posted Dec 04, 2015 05:48 PM

    Dear,

    I am trying to create a simple and basic edge firewall rule with the use of REST API.

    I am using the REST API guide as a reference on page 158.



    I am using the  following (simple) code in my REST API client (with the correct Content-Type (application/xml)):

    <rule>

      <ruleTag></ruleTag>

      <name>edge5-rest-rule</name>

      <source>any</source>

      <destination>any</destination>

      <application>any</application>

      <matchTranslated>true</matchTranslated>

      <direction>in</direction>

      <action>deny</action>

      <enabled>false</enabled>

      <loggingEnabled>true</loggingEnabled>

      <description>rest-api-rule</description>

    </rule>

    The error message that I receive is the following:

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

    <error>

        <details>Invalid request. Could not find mapping for element rule.</details>

        <errorCode>223</errorCode>

    </error>

    The full screenshot of my REST API action is in the screenshot below:

    Does anyone know what I am doing wrong here?

    Thanks!



  • 2.  RE: ISSUE: Can not create an (edge) Firewall rule with the REST API
    Best Answer

    Broadcom Employee
    Posted Dec 04, 2015 10:21 PM

    Try this as the body...

    <firewallRules>

    <firewallRule>

    <name>rest-rule</name>

    <ruleType>user</ruleType>

    <matchTranslated>true</matchTranslated>

    <direction>in</direction>

    <action>deny</action>

    <enabled>false</enabled>

    <loggingEnabled>true</loggingEnabled>

    <description>rest-api-rule</description>

    </firewallRule>

    </firewallRules>



  • 3.  RE: ISSUE: Can not create an (edge) Firewall rule with the REST API

    Posted Dec 05, 2015 08:09 AM

    Hey larsonm‌ thanks for your answer,

    I indeed found out that the syntax that you are providing IS working.

    I now wonder why the syntax in the "official" NSX REST API guide is not working / correct.



  • 4.  RE: ISSUE: Can not create an (edge) Firewall rule with the REST API

    Posted Apr 02, 2021 03:12 PM

    Hi 

    I have this issue too
    did you solve this issue?