<?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: Using the API to get unused and used rules in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27468#M711</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone for the responses.&amp;nbsp; All of them works &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://live.paloaltonetworks.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Jul 2014 23:32:02 GMT</pubDate>
    <dc:creator>StefanV</dc:creator>
    <dc:date>2014-07-16T23:32:02Z</dc:date>
    <item>
      <title>Using the API to get unused and used rules</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27464#M707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am trying to use the API to get a list of unused and another of used rules.&amp;nbsp; Via the API I only get the following error&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;response status="error"&amp;gt;&amp;lt;msg&amp;gt;&amp;lt;line&amp;gt;An error occured. See dagger.log for information.&amp;lt;/line&amp;gt;&amp;lt;/msg&amp;gt;&amp;lt;/response&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also tried with the following&lt;/P&gt;&lt;P&gt;&lt;A href="https://hostname/api/?type=op&amp;amp;action=show&amp;amp;key=PaloaltoKey&amp;amp;xpath=/show/running/rule-use/rule-base=security/type=used/vsys=vsys1" title="https://hostname/api/?type=op&amp;amp;action=show&amp;amp;key=PaloaltoKey&amp;amp;xpath=/show/running/rule-use/rule-base=security/type=used/vsys=vsys1"&gt;https://hostname/api/?type=op&amp;amp;action=show&amp;amp;key=PaloaltoKey&amp;amp;xpath=/show/running/rule-use/rule-base=security/type=used/vsys…&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then get a list of all policies.&amp;nbsp; This does not change even if I change from used to unused, or from security to nat or pbf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know how to get an api command that will simply list the unused security rules as on e would get from a normal command line query?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope so,&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2014 13:55:42 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27464#M707</guid>
      <dc:creator>StefanV</dc:creator>
      <dc:date>2014-07-11T13:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Using the API to get unused and used rules</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27465#M708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you seen the option on the GUI?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Policy tab and on the bottom of the screen is the check box to highlight unused policies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Jul 2014 21:25:36 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27465#M708</guid>
      <dc:creator>pulukas</dc:creator>
      <dc:date>2014-07-11T21:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using the API to get unused and used rules</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27466#M709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;You need send the following over the API,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;show&amp;gt;&amp;lt;running&amp;gt;&amp;lt;rule-use&amp;gt;&amp;lt;vsys&amp;gt;vsys1&amp;lt;/vsys&amp;gt;&amp;lt;type&amp;gt;unused&amp;lt;/type&amp;gt;&amp;lt;rule-base&amp;gt;security&amp;lt;/rule-base&amp;gt;&amp;lt;/rule-use&amp;gt;&amp;lt;/running&amp;gt;&amp;lt;/show&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The resultant URL would look look like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="https://MYFIREWALL/api/?cmd=%3Cshow%3E%3Crunning%3E%3Crule-use%3E%3Cvsys%3Evsys1%3C%2Fvsys%3E%3Ctype%3Eunused%3C%2Ftype%3E%3Crule-base%3Esecurity%3C%2Frule-base%3E%3C%2Frule-use%3E%3C%2Frunning%3E%3C%2Fshow%3E&amp;amp;type=op&amp;amp;key=MYKEY" rel="nofollow"&gt;https://MYFIREWALL/api/?cmd=%3Cshow%3E%3Crunning%3E%3Crule-use%3E%3Cvsys%3Evsys1%3C%2Fvsys%3E%3Ctype%3Eunused%3C%2Ftype%3E%3Crule-base%3Esecurity%3C%2Frule-base%3E%3C%2Frule-use%3E%3C%2Frunning%3E%3C%2Fshow%3E&amp;amp;type=op&amp;amp;key=MYKEY&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jul 2014 15:00:00 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27466#M709</guid>
      <dc:creator>ajbool</dc:creator>
      <dc:date>2014-07-13T15:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using the API to get unused and used rules</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27467#M710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10.5pt; font-family: 'Calibri','sans-serif';"&gt;Hello &lt;A href="https://live.paloaltonetworks.com/u1/27423"&gt;StefanV&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10.5pt; font-family: 'Calibri','sans-serif';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black; font-size: 10.5pt; font-family: 'Calibri','sans-serif';"&gt;Please try this one:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;&lt;A href="https://192.168.50.10/api/?REST_API_TOKEN=1239250485&amp;amp;type=op&amp;amp;cmd=%3Cshow%3E%3Crunning%3E%3Crule-use%3E%3Cvsys%3Evsys1%3C%2Fvsys%3E%3Crule-base%3Esecurity%3C%2Frule-base%3E%3Ctype%3Eunused%3C%2Ftype%3E%3C%2Frule-use%3E%3C%2Frunning%3E%3C%2Fshow%3E"&gt;https://192.168.50.10/api/?REST_API_TOKEN=1239250485&amp;amp;type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;running&amp;gt;&amp;lt;rule-use&amp;gt;&amp;lt;vsys&amp;gt;vsys1&amp;lt;/vsys&amp;gt;&amp;lt;rule-base&amp;gt;security&amp;lt;/rule-base&amp;gt;&amp;lt;type&amp;gt;unused&amp;lt;/type&amp;gt;&amp;lt;/rule-use&amp;gt;&amp;lt;/running&amp;gt;&amp;lt;/show&amp;gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;Hope that helps!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;Thanks and regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10.5pt; font-family: 'Calibri','sans-serif'; color: black;"&gt;Kunal Adak&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 17:51:18 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27467#M710</guid>
      <dc:creator>kadak</dc:creator>
      <dc:date>2014-07-16T17:51:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using the API to get unused and used rules</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27468#M711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks everyone for the responses.&amp;nbsp; All of them works &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://live.paloaltonetworks.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 23:32:02 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/27468#M711</guid>
      <dc:creator>StefanV</dc:creator>
      <dc:date>2014-07-16T23:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using the API to get unused and used rules</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/256839#M1891</link>
      <description>&lt;P&gt;I wanted to provide an example if using Panorama.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a snippet from Postman where i have variables for Panorama and the associated api key {{prod-panorama}} and whatever device-group I want to review {{device-group}}.&amp;nbsp; To retrieve pre-rules with no hits:&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="no hits.JPG" style="width: 300px;"&gt;&lt;img src="https://live.paloaltonetworks.com/t5/image/serverpage/image-id/19534iA17903E3D901EA0E/image-size/small/is-moderation-mode/true?v=v2&amp;amp;px=200" role="button" title="no hits.JPG" alt="no hits.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 18:41:23 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/256839#M1891</guid>
      <dc:creator>jasonrakers</dc:creator>
      <dc:date>2019-04-09T18:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using the API to get unused and used rules</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/397130#M2624</link>
      <description>&lt;P&gt;Hi thank you for sharing the API for using panorama, one more question if i may&lt;/P&gt;&lt;P&gt;Do you know if there is any API using Panorama that i can get all used rules with timestamp of last used.&lt;/P&gt;&lt;P&gt;from the API above i can get only the&amp;nbsp;timestamp of last modify and&amp;nbsp;timestamp of creation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/26088"&gt;@jasonrakers&lt;/a&gt;&amp;nbsp;your help will be much appreciated&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 07:38:24 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/397130#M2624</guid>
      <dc:creator>Serhan</dc:creator>
      <dc:date>2021-04-12T07:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using the API to get unused and used rules</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/406414#M2659</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/40392"&gt;@Serhan&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;At Panorama level, this command will get stats for all rules at summary level:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://{{host}}/api?key={{key}}&amp;amp;type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;rule-hit-count&amp;gt;&amp;lt;device-group&amp;gt;&amp;lt;entry name='{{device-group-name}}'&amp;gt;&amp;lt;pre-rulebase&amp;gt;&amp;lt;entry name='security'&amp;gt;&amp;lt;rules&amp;gt;&amp;lt;all/&amp;gt;&amp;lt;/rules&amp;gt;&amp;lt;/entry&amp;gt;&amp;lt;/pre-rulebase&amp;gt;&amp;lt;/entry&amp;gt;&amp;lt;/device-group&amp;gt;&amp;lt;/rule-hit-count&amp;gt;&amp;lt;/show&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;If you use a similar command for a specific rule, you can detailed stats including &lt;FONT face="courier new,courier"&gt;last-hit-timestamp&lt;/FONT&gt;:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://{{host}}/api?key={{key}}&amp;amp;type=op&amp;amp;cmd=&amp;lt;show&amp;gt;&amp;lt;rule-hit-count&amp;gt;&amp;lt;device-group&amp;gt;&amp;lt;entry name='{{device-group-name}}'&amp;gt;&amp;lt;pre-rulebase&amp;gt;&amp;lt;entry name='security'&amp;gt;&amp;lt;rules&amp;gt;&amp;lt;rule-name&amp;gt;&amp;lt;entry name='{{rule-name}}'/&amp;gt;&amp;lt;/rule-name&amp;gt;&amp;lt;/rules&amp;gt;&amp;lt;/entry&amp;gt;&amp;lt;/pre-rulebase&amp;gt;&amp;lt;/entry&amp;gt;&amp;lt;/device-group&amp;gt;&amp;lt;/rule-hit-count&amp;gt;&amp;lt;/show&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;Hope that helps.&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 16:17:35 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/using-the-api-to-get-unused-and-used-rules/m-p/406414#M2659</guid>
      <dc:creator>JimmyHolland</dc:creator>
      <dc:date>2021-05-12T16:17:35Z</dc:date>
    </item>
  </channel>
</rss>

