<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API - Security Rule Syntax in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190178#M1521</link>
    <description>&lt;P&gt;The rule-type seems to be optional, but I've&amp;nbsp;always specified it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, that error you're getting has to do with the user you're using to do these operations.&amp;nbsp; Looks like it needs more permissions to create the security rule:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.paloaltonetworks.com/documentation/71/pan-os/xml-api/pan-os-xml-api-error-codes" target="_blank"&gt;https://www.paloaltonetworks.com/documentation/71/pan-os/xml-api/pan-os-xml-api-error-codes&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Dec 2017 19:56:09 GMT</pubDate>
    <dc:creator>gfreeman</dc:creator>
    <dc:date>2017-12-05T19:56:09Z</dc:date>
    <item>
      <title>API - Security Rule Syntax</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190122#M1515</link>
      <description>&lt;P&gt;Version: PAN-OS 8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to create new security rules in Panorama, but keep getting a response that says a schema node cannot be found&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code in a PS function, where $Name is my intended rule name, and $DeviceAddress is my Panorama address&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Invoke-RestMethod "https://$DeviceAddress/api/?type=config&amp;amp;action=set&amp;amp;key=$apiKey&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='$Name']&amp;amp;element=$script:requestXML" -Method Post"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could not find schema node for xpath /config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='MY Arbitrary Rule Name']&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone clarify what is incorrect about the XPath, please?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 16:46:02 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190122#M1515</guid>
      <dc:creator>f1r3withf1r3</dc:creator>
      <dc:date>2017-12-05T16:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: API - Security Rule Syntax</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190147#M1516</link>
      <description>&lt;P&gt;Your xpath is wrong.&amp;nbsp; If you're doing a `set`, you need to specify the node one above what you're actually setting.&amp;nbsp; For `edit` and `delete` you specify the node itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your case, since you're trying to `set`, your xpath should actually be this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN class="s1"&gt;`/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules`&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 17:49:11 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190147#M1516</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2017-12-05T17:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: API - Security Rule Syntax</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190148#M1517</link>
      <description>&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/46544"&gt;@gfreeman&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So how does one specify a rule name in the xpath?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I run&lt;/P&gt;&lt;P&gt;"$query = Invoke-RestMethod "https://$DeviceAddress/api/?type=config&amp;amp;action=set&amp;amp;key=$apiKey&amp;amp;xpath=config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules" -Method Post"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get an Unauthorized request as the response&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 17:56:30 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190148#M1517</guid>
      <dc:creator>f1r3withf1r3</dc:creator>
      <dc:date>2017-12-05T17:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: API - Security Rule Syntax</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190149#M1518</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The rule name&amp;nbsp;should be in the XML document that you're posting, which&amp;nbsp;could look something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;entry name="MY Arbitrary Rule Name"&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;rule-type&amp;gt;universal&amp;lt;/rule-type&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;description&amp;gt;&amp;lt;/description&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;from&amp;gt;&amp;lt;member&amp;gt;zone1&amp;lt;/member&amp;gt;&amp;lt;/from&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;to&amp;gt;&amp;lt;member&amp;gt;zone2&amp;lt;/member&amp;gt;&amp;lt;/to&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;source&amp;gt;&amp;lt;member&amp;gt;any&amp;lt;/member&amp;gt;&amp;lt;/source&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;negate-source&amp;gt;no&amp;lt;/negate-source&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;source-user&amp;gt;&amp;lt;member&amp;gt;any&amp;lt;/member&amp;gt;&amp;lt;/source-user&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;hip-profiles&amp;gt;&amp;lt;member&amp;gt;any&amp;lt;/member&amp;gt;&amp;lt;/hip-profiles&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;destination&amp;gt;&amp;lt;member&amp;gt;any&amp;lt;/member&amp;gt;&amp;lt;/destination&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;negate-destination&amp;gt;no&amp;lt;/negate-destination&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;application&amp;gt;&amp;lt;member&amp;gt;any&amp;lt;/member&amp;gt;&amp;lt;/application&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;service&amp;gt;&amp;lt;member&amp;gt;application-default&amp;lt;/member&amp;gt;&amp;lt;/service&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;category&amp;gt;&amp;lt;member&amp;gt;any&amp;lt;/member&amp;gt;&amp;lt;/category&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;action&amp;gt;allow&amp;lt;/action&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;log-start&amp;gt;no&amp;lt;/log-start&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;log-end&amp;gt;yes&amp;lt;/log-end&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;disabled&amp;gt;no&amp;lt;/disabled&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;icmp-unreachable&amp;gt;no&amp;lt;/icmp-unreachable&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;lt;option&amp;gt;&amp;lt;disable-server-response-inspection&amp;gt;no&amp;lt;/disable-server-response-inspection&amp;gt;&amp;lt;/option&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;lt;/entry&amp;gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 17:57:44 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190149#M1518</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2017-12-05T17:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: API - Security Rule Syntax</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190177#M1520</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/46544"&gt;@gfreeman&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far, I think I've figured out the proper way to pass an xml document in Powershell, but still get an Unauthorized Request response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is a rule-type required in the XML object?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or rather, what fields are required in order to POST?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 19:52:05 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190177#M1520</guid>
      <dc:creator>f1r3withf1r3</dc:creator>
      <dc:date>2017-12-05T19:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: API - Security Rule Syntax</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190178#M1521</link>
      <description>&lt;P&gt;The rule-type seems to be optional, but I've&amp;nbsp;always specified it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, that error you're getting has to do with the user you're using to do these operations.&amp;nbsp; Looks like it needs more permissions to create the security rule:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.paloaltonetworks.com/documentation/71/pan-os/xml-api/pan-os-xml-api-error-codes" target="_blank"&gt;https://www.paloaltonetworks.com/documentation/71/pan-os/xml-api/pan-os-xml-api-error-codes&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 19:56:09 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/api-security-rule-syntax/m-p/190178#M1521</guid>
      <dc:creator>gfreeman</dc:creator>
      <dc:date>2017-12-05T19:56:09Z</dc:date>
    </item>
  </channel>
</rss>

