<?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: Wildcards in rest api configuration query? in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150352#M1361</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;client requests MiddleAPI.getAllRulesMatchingX -&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; MiddleAPI requests PAN_API.getFullConfigDump&lt;/P&gt;&lt;P&gt;&amp;nbsp; MiddleAPI parse XML, filters records of interest, add a 'loc' property&lt;/P&gt;&lt;P&gt;&amp;nbsp; MiddleAPI sends answer to client&lt;/P&gt;</description>
    <pubDate>Thu, 30 Mar 2017 09:17:39 GMT</pubDate>
    <dc:creator>cpainchaud</dc:creator>
    <dc:date>2017-03-30T09:17:39Z</dc:date>
    <item>
      <title>Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149847#M1348</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to write a reporting tool that will go throguh various device groups and identify rules that have certain keywords (change numbers in my case) in the description.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm querying panorama configuration and using rest api directly from python (e.g. requests module or pan.xapi)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, this query works perfectly for me and as a result I get two rules returned back, if description contains only one string &lt;SPAN&gt;CHG99646&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Perth']/pre-rulebase/security/rules/entry[description="CHG99646"]&lt;/P&gt;&lt;DIV class="line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;response&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;status&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;success&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;code&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;19&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;result&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;total-count&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;2&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;count&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;2&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="collapsed"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;entry&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;name&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;Rule127&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;loc&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;Perth&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="text"&gt;...&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/entry&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="collapsed"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;entry&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;name&lt;/SPAN&gt;="Rule139"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;loc&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;Perth&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="text"&gt;...&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/entry&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&amp;nbsp;...&lt;/DIV&gt;&lt;DIV class="line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;However, my queries stop working in case description contains multiple lines. E.g if my rule entry is like this:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;response&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;status&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;success&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;code&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;19&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;result&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;total-count&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;1&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;count&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;1&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;entry&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;name&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;Rule87&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt; &lt;SPAN class="html-attribute-name"&gt;loc&lt;/SPAN&gt;="Perth"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;profile-setting&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;group&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;member&amp;gt;Source123&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/member&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/group&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;action&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="text"&gt;allow&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/action&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;description&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="text"&gt;CHG128742 CHG135069 CHG139311 CHG142080&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/description&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="line"&gt;I am unable to find this rule if I put a query like&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN&gt;/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Perth']/pre-rulebase/security/rules/entry[description="CHG139311"]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN&gt;Is there any way to have ~ (like) matching here or to use wildcards (e.g. .*&amp;lt;matchpattern&amp;gt;.*) so I could identify rule(s) based on part of the description content and not the entire decription content?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN&gt;I am aware that I can pull the entire rulebase and then parse it localy. But the point here is to avoid this. If there are e.g. 20 device groups and each device group has 1000+ rules, pulling 20.000 rules will take forever and it would be much more efficient if I can just return rules matching certain patterns like explained above.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN&gt;Milos&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 28 Mar 2017 07:11:58 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149847#M1348</guid>
      <dc:creator>KostiM</dc:creator>
      <dc:date>2017-03-28T07:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149848#M1349</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;The API is not designed for that. It has limited support for XPath and pulling data locally is probably the only way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;There are as well exisiting utilities which can do what you are looking for already, like one of mine here:&amp;nbsp;&lt;A href="https://live.paloaltonetworks.com/t5/API-Articles/rules-edit-php-to-manage-edit-export-rules-from-CLI/ta-p/53321" target="_blank"&gt;https://live.paloaltonetworks.com/t5/API-Articles/rules-edit-php-to-manage-edit-export-rules-from-CLI/ta-p/53321&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 07:20:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149848#M1349</guid>
      <dc:creator>cpainchaud</dc:creator>
      <dc:date>2017-03-28T07:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149851#M1350</link>
      <description>&lt;P&gt;OK, so Palo Alto decided not to implement %like% in their rest api. Understood.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know if there is an op command that I could incorporate instead of using wildcards in the xpath matching? Something similar to global find in panorama gui or a | match when I am running show configuration? I mean, anything that will return a security rule&amp;nbsp;name(s) based on text I want to find in description.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Milos&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 07:46:45 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149851#M1350</guid>
      <dc:creator>KostiM</dc:creator>
      <dc:date>2017-03-28T07:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149852#M1351</link>
      <description>&lt;P&gt;What I mean is that PAN is using Xpath, so you can use what Xpath has available:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In your case, something like that should work :&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;[contains(text(),'whatYouWantHere')]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;concerning your other question about Global Find and such : it's not exposed to through API unfortunatly. But it's somethign available on my project if you dont mind using it and/or developping in PHP &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 07:50:58 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149852#M1351</guid>
      <dc:creator>cpainchaud</dc:creator>
      <dc:date>2017-03-28T07:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149853#M1352</link>
      <description>&lt;P&gt;I'm trying to use your suggestion with contains text but I am not able to match anything&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you give a full xpath example for matching description field with [contains(text(),'whatYouWantHere')]? I'm missing something when trying to use your suggestion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the PHP I have minimal knowledge there &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Milos&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 07:56:26 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149853#M1352</guid>
      <dc:creator>KostiM</dc:creator>
      <dc:date>2017-03-28T07:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149854#M1353</link>
      <description>&lt;P&gt;YES! Figured it out:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Perth']/pre-rulebase/security/rules/entry[description[contains(text(), 'CHG129149')]]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works as a charm and gives me exactly what I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thsi is so cool. I am going to accept your answer as the solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Milos&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 08:06:24 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149854#M1353</guid>
      <dc:creator>KostiM</dc:creator>
      <dc:date>2017-03-28T08:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149856#M1354</link>
      <description>&lt;P&gt;you are welcome! Remember it's just standard XPath 1.0 so you can google for more examples of syntaxes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Concerning my PHP lib: it's a set of utilities that are ready to run (no scripting skills involved, just invoke them) and a framework for devs. You might want to have a look if you dont want to reinvent the wheel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cheers !&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 08:27:30 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/149856#M1354</guid>
      <dc:creator>cpainchaud</dc:creator>
      <dc:date>2017-03-28T08:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150310#M1355</link>
      <description>&lt;P&gt;I see that you are very good with xpath 1.0. I'm wondering if you have any suggestions/solutions for the following scenario or if this is not possible to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Say I use query xpath like this:&lt;/P&gt;&lt;P&gt;/config/devices/entry[@name='localhost.localdomain']/device-group/entry[@name='Tokyo']/pre-rulebase/security/rules/entry[description[contains(text(), 'CHG84226')]]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a response I get the entry (or entries) with attribute 'loc' that's set to the current device group:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;response&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;status&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;success&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;code&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;19&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;result&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;total-count&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;1&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;count&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;1&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;entry&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;name&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;Rule1293&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;loc&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;Tokyo&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;profile-setting&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;group&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;member&amp;gt;SecProfile2&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/member&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/group&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/profile-setting&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now if I change Xpath to ommit the part for device group as I want to build a search that will identify description with certain CHG text value on all device groups and find security rules accross all device groups, I get the positive response and entry is listed back, but I lose the *loc* attribute so my policy doesn't show where exactly it belongs to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example (device group entry part is replaced with //:&lt;/P&gt;&lt;P&gt;/config/devices/entry[@name='localhost.localdomain']/device-group//pre-rulebase/security/rules/entry[description[contains(text(), 'CHG84226')]]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;response&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;status&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;success&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;code&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;19&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;result&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;total-count&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;8&lt;/SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;count&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;8&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;entry&lt;SPAN class="html-attribute"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="html-attribute-name"&gt;name&lt;/SPAN&gt;="&lt;SPAN class="html-attribute-value"&gt;Rule1341&lt;/SPAN&gt;"&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;option&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;disable-server-response-inspection&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="text"&gt;no&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/disable-server-response-inspection&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/option&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;from&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;member&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="text"&gt;trust&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/member&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/from&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;to&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class="collapsible-content"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;member&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="text"&gt;untrust&lt;/SPAN&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/member&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;/to&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="collapsible"&gt;&lt;DIV class="expanded"&gt;&lt;DIV class="line"&gt;&lt;SPAN class="html-tag"&gt;&amp;lt;source&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas what could I possibly use in xpath to return something meaningful that can help me identifying where exactly this rule belongs to (rules in the case above as 'CHG84226' exists as a description on 8 rules accross 8 different device groups). I know that I can use rule name and query individual device groups one by one but in my case I've got 20 device groups and one query costs around 1 second so it adds up to a large waiting time when the script is executed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you reckon I should post this as a separate question, I don't mind reposting this in its entirety.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for suggestions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 03:52:49 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150310#M1355</guid>
      <dc:creator>KostiM</dc:creator>
      <dc:date>2017-03-30T03:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150344#M1356</link>
      <description>&lt;P&gt;this 'loc' property is added by PANOS, it's not part of XPath at all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The fact it displaying in one case but not another is a mystery to me : it's not even a 'documented' feature of PANOS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will find yourself quickly limited with XPath because it doesn't fit all purposes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would usually script that : download the candidate config -&amp;gt; parse what I want (you can use XPath inside python as well if you don't want to code navigate through Xml tree by yourself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can I ask what kind of action you would like to do after you foudn the rules you need ?&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 08:38:45 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150344#M1356</guid>
      <dc:creator>cpainchaud</dc:creator>
      <dc:date>2017-03-30T08:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150347#M1357</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm writing an application in Python Django to expose certain areas of palo altos to our developers so they can be self sufficient and be able to identify changes that we made on firewalls, find out if their application is being blocked by deny policy and so on. We don't want to give people access to palo altos themselves + most of the people wouldn't know what to do once they connect to firewalls.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my way, my simple web interface would provide just enough functionality to do simple tasks such as what I mentioned above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get your point for downloading the entire config. In my case that won't be efficient.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ ./rt.py&lt;/P&gt;&lt;P&gt;Start&lt;/P&gt;&lt;P&gt;/config/devices&lt;/P&gt;&lt;P&gt;End request, returned XML in 28.5984241962&lt;/P&gt;&lt;P&gt;Converting XML to DICT&lt;/P&gt;&lt;P&gt;End xmltodict&lt;/P&gt;&lt;P&gt;Done&lt;/P&gt;&lt;P&gt;Finished conversion 44.2386090755&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It takes ~28 seconds to download the entire config in XML format. As I can't really use XML for the rest of my python stuff and Dictionary / OrderedDict is something much more useful, I then convert XML to Python Dictionary. As you can see it takes additional 16 seconds to convert literary everything to a massive dict that I'm only using a ridiculously small portion of.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In total 44.2 seconds, that's a lot of time to waitfor each request &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And all I need to do is to display few policies to someone who enters a description text to search for. I don't think that's very efficient and this is why I am trying to find the way to limit the output as much as I can with xpath but still have enough information to work with to display necessary info to the user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Milos&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 08:51:40 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150347#M1357</guid>
      <dc:creator>KostiM</dc:creator>
      <dc:date>2017-03-30T08:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150348#M1358</link>
      <description>&lt;P&gt;Unfortinately, PANOS doesn't provide API features to search for objects and such. The XPath is oringally designed to name a 'path' in the XML rather than doing searches.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why does it take so long to get the condicate config ? Bandwidth issue or PANOS is too slow ? It should be instant almost&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 09:01:29 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150348#M1358</guid>
      <dc:creator>cpainchaud</dc:creator>
      <dc:date>2017-03-30T09:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150350#M1359</link>
      <description>&lt;P&gt;Config is 18MB in size&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;$ ./rt.py&lt;/P&gt;&lt;P&gt;Start&lt;/P&gt;&lt;P&gt;/config/devices&lt;/P&gt;&lt;P&gt;End request, returned XML in 28.5243420601&lt;/P&gt;&lt;P&gt;Size in bytes: 18714100&lt;/P&gt;&lt;P&gt;Converting XML to DICT&lt;/P&gt;&lt;P&gt;End xmltodict&lt;/P&gt;&lt;P&gt;Done&lt;/P&gt;&lt;P&gt;Finished conversion 44.2015681267&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And palo alto Panorama is located on the other side of the world (accessing it over WAN)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is your config size that you are normally downloading when you say it is almost instant?&lt;/P&gt;&lt;P&gt;Even if it was instant I still have about 18 seconds to convert XML to Dictionary but I could live with that (if only was instant as you say &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 09:08:08 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150350#M1359</guid>
      <dc:creator>KostiM</dc:creator>
      <dc:date>2017-03-30T09:08:08Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150351#M1360</link>
      <description>&lt;P&gt;I quit using XML to dictionary/json/arrays a long time ago : it's way too slow. I parse XML directly with libxml and alike.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your case, to solve your bandwidth issues, I would have a middleware/application-proxy that would be excuted in the same datacenter as the firewall/panorama. This mini-API of yours would be able to acess the firewall without any bandwidth or latency constraint and would then just return the pieces of interest to you.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 09:14:42 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150351#M1360</guid>
      <dc:creator>cpainchaud</dc:creator>
      <dc:date>2017-03-30T09:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Wildcards in rest api configuration query?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150352#M1361</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;client requests MiddleAPI.getAllRulesMatchingX -&amp;gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; MiddleAPI requests PAN_API.getFullConfigDump&lt;/P&gt;&lt;P&gt;&amp;nbsp; MiddleAPI parse XML, filters records of interest, add a 'loc' property&lt;/P&gt;&lt;P&gt;&amp;nbsp; MiddleAPI sends answer to client&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2017 09:17:39 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/wildcards-in-rest-api-configuration-query/m-p/150352#M1361</guid>
      <dc:creator>cpainchaud</dc:creator>
      <dc:date>2017-03-30T09:17:39Z</dc:date>
    </item>
  </channel>
</rss>

