<?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: Retrieve policy details using api in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Retrieve-policy-details-using-api/m-p/75549#M4400</link>
    <description>It's a little more complicated than that.&lt;BR /&gt;Here's a couple of Open Source projects we have that do this (in Python), one for export/import, the other to render in HTML/JSON:&lt;BR /&gt;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Python-tool-for-exporting-importing-a-policy-package-or-parts-of/m-p/41100" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Python-tool-for-exporting-importing-a-policy-package-or-parts-of/m-p/41100&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Show-Package-Tool-to-visualize-a-R80-policy-package-over-HTML/td-p/39821" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Show-Package-Tool-to-visualize-a-R80-policy-package-over-HTML/td-p/39821&lt;/A&gt;</description>
    <pubDate>Tue, 18 Feb 2020 01:57:04 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2020-02-18T01:57:04Z</dc:date>
    <item>
      <title>Retrieve policy details using api</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Retrieve-policy-details-using-api/m-p/75479#M4396</link>
      <description>&lt;P&gt;I am trying to write a script to retrieve all policy details of R80 using web services api. I used show-package command to retrieve all policy package details . Also i made details-level full to retrieve all possible info. I wonder if this call will retrieve all the information about the package and all it's&amp;nbsp; objects ?&lt;/P&gt;&lt;P&gt;here is my python code&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests, json&lt;/P&gt;&lt;P&gt;host = "" # hard code host&lt;BR /&gt;port = "" # hard code port&lt;BR /&gt;def api_call(ip_addr, port, command, json_payload, sid):&lt;BR /&gt;url = 'https://' + ip_addr + ':' + port + '/web_api/' + command&lt;BR /&gt;if sid == '':&lt;BR /&gt;request_headers = {'Content-Type' : 'application/json'}&lt;BR /&gt;else:&lt;BR /&gt;request_headers = {'Content-Type' : 'application/json', 'X-chkp-sid' : sid}&lt;BR /&gt;r = requests.post(url,data=json.dumps(json_payload), headers=request_headers)&lt;BR /&gt;return r.json()&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;def login(user,password):&lt;BR /&gt;payload = {'user':user, 'password' : password}&lt;BR /&gt;response = api_call(host, port, 'login',payload, '')&lt;BR /&gt;return response["sid"]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;def retrieve_policy(username,password,package_name):&lt;BR /&gt;sid = login(username,password) #get sid after successful login to authenticate with&lt;/P&gt;&lt;P&gt;retrieve_policy_data = {'name' : package_name,'details-level' : 'full'} #I made details-level full to retieve all possible info&lt;BR /&gt;retrieve_policy_result = api_call(host, port,'show-package', retrieve_policy_data ,sid)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;logout_result = api_call(host, port,"logout", {},sid) #logout&lt;/P&gt;&lt;P&gt;return retrieve_policy_result #all package details returned in json format&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 13:07:08 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Retrieve-policy-details-using-api/m-p/75479#M4396</guid>
      <dc:creator>abdo</dc:creator>
      <dc:date>2020-02-17T13:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve policy details using api</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Retrieve-policy-details-using-api/m-p/75512#M4398</link>
      <description>Also interested..</description>
      <pubDate>Mon, 17 Feb 2020 16:40:59 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Retrieve-policy-details-using-api/m-p/75512#M4398</guid>
      <dc:creator>Will_H</dc:creator>
      <dc:date>2020-02-17T16:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve policy details using api</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Retrieve-policy-details-using-api/m-p/75549#M4400</link>
      <description>It's a little more complicated than that.&lt;BR /&gt;Here's a couple of Open Source projects we have that do this (in Python), one for export/import, the other to render in HTML/JSON:&lt;BR /&gt;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Python-tool-for-exporting-importing-a-policy-package-or-parts-of/m-p/41100" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Python-tool-for-exporting-importing-a-policy-package-or-parts-of/m-p/41100&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Show-Package-Tool-to-visualize-a-R80-policy-package-over-HTML/td-p/39821" target="_blank"&gt;https://community.checkpoint.com/t5/API-CLI-Discussion-and-Samples/Show-Package-Tool-to-visualize-a-R80-policy-package-over-HTML/td-p/39821&lt;/A&gt;</description>
      <pubDate>Tue, 18 Feb 2020 01:57:04 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Retrieve-policy-details-using-api/m-p/75549#M4400</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-02-18T01:57:04Z</dc:date>
    </item>
  </channel>
</rss>

