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:
Thanks!
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>
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>
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.
Hi
I have this issue too
did you solve this issue?