<?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: Configuration Table Export csv by api? in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215321#M1676</link>
    <description>&lt;P&gt;that might work, I was not able to satisfactorily use python3.x to convert it correctly, very likely it is my lack of knowledge though which is why I was trying this alternative method. have any literature you can share that may assist?&lt;/P&gt;</description>
    <pubDate>Thu, 24 May 2018 13:27:15 GMT</pubDate>
    <dc:creator>ajr0</dc:creator>
    <dc:date>2018-05-24T13:27:15Z</dc:date>
    <item>
      <title>Configuration Table Export csv by api?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215194#M1674</link>
      <description>&lt;P&gt;I might be missing it however does anyone know if the configuration table export option [0] is available through the api?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my goal is to obtain this via api if that is an option. after going through the api browser and check export/show command I am not seeing this functionality anywhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[0] &lt;A href="https://www.paloaltonetworks.com/documentation/81/pan-os/pan-os/firewall-administration/use-the-web-interface/export-configuration-table-data" target="_blank"&gt;https://www.paloaltonetworks.com/documentation/81/pan-os/pan-os/firewall-administration/use-the-web-interface/export-configuration-table-data&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 15:16:52 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215194#M1674</guid>
      <dc:creator>ajr0</dc:creator>
      <dc:date>2018-05-23T15:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: Configuration Table Export csv by api?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215246#M1675</link>
      <description>&lt;P&gt;I do not have a direct answer to your question, but in the past (7.1.x, as it did not have an export to csv option) I have obtained the xml from the api and parsed it into a csv with a script - this may be an alternative for you.&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 19:23:58 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215246#M1675</guid>
      <dc:creator>JoeAndreini</dc:creator>
      <dc:date>2018-05-23T19:23:58Z</dc:date>
    </item>
    <item>
      <title>Re: Configuration Table Export csv by api?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215321#M1676</link>
      <description>&lt;P&gt;that might work, I was not able to satisfactorily use python3.x to convert it correctly, very likely it is my lack of knowledge though which is why I was trying this alternative method. have any literature you can share that may assist?&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 13:27:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215321#M1676</guid>
      <dc:creator>ajr0</dc:creator>
      <dc:date>2018-05-24T13:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Configuration Table Export csv by api?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215358#M1677</link>
      <description>&lt;P&gt;I do not know what you have available in your environment, but I use PowerShell in windows 10 for my API work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Powershell has a cmdlet Invoke-RestMethod that makes it relatively easy to run the API calls and store the resulting XML in a variable.&amp;nbsp; This is important because Powershell will automatically parse the XML into a collection of collections, so each branch is a property of the branch above, like the x-path, allowing you to use a for loop to iterate throuhg each policy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have outlined the steps here &lt;A href="https://live.paloaltonetworks.com/t5/General-Topics/Panorama-Security-Rules-Export-in-Human-Readable-Format-Excel/m-p/213293#M62070" target="_blank"&gt;https://live.paloaltonetworks.com/t5/General-Topics/Panorama-Security-Rules-Export-in-Human-Readable-Format-Excel/m-p/213293#M62070&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;once you have your XML as a variable (let's say $config) powershell represents xml as a collection of collections, so each "branch" in the XML is a property of it's parent, so for isntance $config.vsys.entry[0].ruleset.security.entry[1].name is the name of the second (computers count from&amp;nbsp;0) security policy in the ruleset of your first vsys (even in a single vsys firewall the vsys branch exists) $config.vsys.entry[0].ruleset.security.entry[1].action would be it's action (allow, deny, etc) $config.vsys.entry[0].ruleset.security.entry[100].name&amp;nbsp;would be the 101st rule's name, etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, write some "pseudo-code" of what you want to do, the major steps, then you can try to figure out how to do them.&lt;/P&gt;&lt;P&gt;For instance:&lt;/P&gt;&lt;P&gt;for each $rule in $config&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;write $rule.name, $rule.from, $rule.to, $rule.source, $rule.dest, $rule.action to a file (you may have other properties that are valuable to you)&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A few resources to get you started, if you are interested:&lt;/P&gt;&lt;P&gt;Palo API documentation: &lt;A href="https://www.paloaltonetworks.com/documentation/80/pan-os/xml-api" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;FONT color="#00689a"&gt;https://www.paloaltonetworks.com/documentation/80/pan-os/xml-api&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Invoke-RestMethod, to make the API calls and get information from firewall: &lt;A href="https://blogs.technet.microsoft.com/heyscriptingguy/2013/10/21/invokerestmethod-for-the-rest-of-us/" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;FONT color="#00689a"&gt;https://blogs.technet.microsoft.com/heyscriptingguy/2013/10/21/invokerestmethod-for-the-rest-of-us/&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;ForEach, to loop through items in a collection: &lt;A href="https://blogs.technet.microsoft.com/heyscriptingguy/2014/04/28/basics-of-powershell-looping-foreach/" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;FONT color="#00689a"&gt;https://blogs.technet.microsoft.com/heyscriptingguy/2014/04/28/basics-of-powershell-looping-foreach/&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Export-CSV, to create your csv file once you have teh information you want to put in it: &lt;A href="https://blogs.technet.microsoft.com/heyscriptingguy/2014/02/04/use-powershell-to-create-csv-file-to-open-in-excel/" target="_blank" rel="nofollow noopener noreferrer"&gt;&lt;FONT color="#00689a"&gt;https://blogs.technet.microsoft.com/heyscriptingguy/2014/02/04/use-powershell-to-create-csv-file-to-...&lt;/FONT&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 15:59:06 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215358#M1677</guid>
      <dc:creator>JoeAndreini</dc:creator>
      <dc:date>2018-05-24T15:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Configuration Table Export csv by api?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215370#M1678</link>
      <description>&lt;P&gt;this is great info, I am restricted to python3.x at the moment but I will benefit from this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks again!&lt;/P&gt;</description>
      <pubDate>Thu, 24 May 2018 18:13:03 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215370#M1678</guid>
      <dc:creator>ajr0</dc:creator>
      <dc:date>2018-05-24T18:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Configuration Table Export csv by api?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215492#M1679</link>
      <description>&lt;P&gt;I have parsed xml with python on another project - it was difficult but doable if the format is predictable (the format of these configs is very predictable, thankfully)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding your original query... Most of my sites run 7.1 so I cannot give specific guidance, but maybe there is a CLI version of the csv export that you could pass to the API as an "op" command?&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 12:38:43 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215492#M1679</guid>
      <dc:creator>JoeAndreini</dc:creator>
      <dc:date>2018-05-25T12:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Configuration Table Export csv by api?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215511#M1680</link>
      <description>&lt;P&gt;You could do this with &lt;A title="Device Framework" href="https://live.paloaltonetworks.com/deviceframework" target="_self"&gt;Device Framework&lt;/A&gt;, which parses the API XML into python dictionaries that you can easily output via CSV.&amp;nbsp; Here is a code example in python3:&amp;nbsp;&amp;nbsp;&lt;A href="https://gist.github.com/btorresgil/0fa16f2e67de67e313e2f66f401c7c4b" target="_blank"&gt;https://gist.github.com/btorresgil/0fa16f2e67de67e313e2f66f401c7c4b&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The outputed fields are in alphabetical order, but you could change the order if you like.&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 17:31:16 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215511#M1680</guid>
      <dc:creator>btorresgil</dc:creator>
      <dc:date>2018-05-25T17:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Configuration Table Export csv by api?</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215521#M1681</link>
      <description>&lt;P&gt;this is great, will spend time wrapping my head around this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: after looking at some of this I was not even aware of this library, wow this is really great.&amp;nbsp; Thank you again for sharing!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 May 2018 19:45:06 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/configuration-table-export-csv-by-api/m-p/215521#M1681</guid>
      <dc:creator>ajr0</dc:creator>
      <dc:date>2018-05-25T19:45:06Z</dc:date>
    </item>
  </channel>
</rss>

