<?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: Security Rule API in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194701#M1534</link>
    <description>&lt;P&gt;Are you doing the rules one by one, or all the rules at once? If you use the following call, you could retain the order of the entire rulebase and use indexing in your logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=config&amp;amp;action=get&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other thing that comes to mind is the action=move call on the configuration like so:&lt;/P&gt;&lt;PRE&gt;/api/?type=config&amp;amp;action=move&amp;amp;xpath=/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='rule1']&amp;amp;where=after&amp;amp;dst=rule2 &lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Jan 2018 19:54:28 GMT</pubDate>
    <dc:creator>nigelswift</dc:creator>
    <dc:date>2018-01-10T19:54:28Z</dc:date>
    <item>
      <title>Security Rule API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194674#M1533</link>
      <description>&lt;P&gt;I've got a powershell script working that copies my security rules from one device to another but I need to control the order that they are inserted at the destination. I haven't been able to find this in the API browser or other examples. Does anyone know how to get the rule number or order? Or on the insert side?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 18:16:00 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194674#M1533</guid>
      <dc:creator>Ntripp</dc:creator>
      <dc:date>2018-01-10T18:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Security Rule API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194701#M1534</link>
      <description>&lt;P&gt;Are you doing the rules one by one, or all the rules at once? If you use the following call, you could retain the order of the entire rulebase and use indexing in your logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;/api/?type=config&amp;amp;action=get&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The other thing that comes to mind is the action=move call on the configuration like so:&lt;/P&gt;&lt;PRE&gt;/api/?type=config&amp;amp;action=move&amp;amp;xpath=/config/devices/entry/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='rule1']&amp;amp;where=after&amp;amp;dst=rule2 &lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jan 2018 19:54:28 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194701#M1534</guid>
      <dc:creator>nigelswift</dc:creator>
      <dc:date>2018-01-10T19:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Security Rule API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194710#M1535</link>
      <description>&lt;P&gt;I'm pulling them with that xpath:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but then I have to loop through the elements to push them:&lt;/P&gt;&lt;PRE&gt;"?type=config&amp;amp;action=show&amp;amp;key="+ $key + "&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/vsys/entry/rulebase/security"

&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;foreach ($k in ($rules.response.Selectnodes("//entry[@name]"))){

$uri = $papa + "?type=config&amp;amp;action=set&amp;amp;key=" + $key + "&amp;amp;xpath=/config/devices/entry[@name='localhost.localdomain']/vsys/entry[@name='vsys1']/rulebase/security/rules/entry[@name='" +$k.name+']' + "&amp;amp;xpath-value&amp;amp;element=" + $k.InnerXml
invoke-webrequest -uri $uri
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a way to bulk load them? This was the only way I could make the xml usable to push into the other device.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2018 21:11:20 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194710#M1535</guid>
      <dc:creator>Ntripp</dc:creator>
      <dc:date>2018-01-10T21:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: Security Rule API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194799#M1536</link>
      <description>&lt;P&gt;Yes. This is what the first call I supplied does. If you do a get just for the rulebase and then a set of the same xml at the rulebase xpath with the element that you pass, you should be able to move over the entire rulebase.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2018 14:22:06 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/194799#M1536</guid>
      <dc:creator>nigelswift</dc:creator>
      <dc:date>2018-01-11T14:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Security Rule API</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/195954#M1546</link>
      <description>&lt;P&gt;I was able to get the whole rulebase which is the command you supplied (I was already doing that).&amp;nbsp; I was not able to push them all at once and required looping through. Did you have the xpath for set an entire rulebase?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I plan to do is is add tags to the rules add and move them.&amp;nbsp; Seems like there should be a function for rule order placement on the set instead of adding then moving but this is all I have been able to find so far.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2018 18:12:29 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/security-rule-api/m-p/195954#M1546</guid>
      <dc:creator>Ntripp</dc:creator>
      <dc:date>2018-01-19T18:12:29Z</dc:date>
    </item>
  </channel>
</rss>

