<?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: API call to see if rule already exists in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/84991#M4857</link>
    <description>&lt;P&gt;Thanks Nickel for your reply.&lt;/P&gt;&lt;P&gt;however what I have observed whenever i am using the packet&amp;nbsp; mode&amp;nbsp; and filter the source destination and port&amp;nbsp; not getting the consistent output . that is the main issue.&lt;/P&gt;&lt;P&gt;I am querying the rulebase base API and applying the below mentioned filter&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;filter: "src:10.70.101.188 AND dst:10.9.17.65 AND svc:30000 AND action:6c488338-8eec-4103-ad21-cd461ac2c472"&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 May 2020 22:51:04 GMT</pubDate>
    <dc:creator>yogesh_uit08</dc:creator>
    <dc:date>2020-05-12T22:51:04Z</dc:date>
    <item>
      <title>API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/65946#M4056</link>
      <description>&lt;P&gt;Is there an API call to see if a rule already exists? Something better than where-used? Something more along the lines of Packet Mode on the GUI.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 20:56:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/65946#M4056</guid>
      <dc:creator>C_M</dc:creator>
      <dc:date>2019-10-25T20:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/65952#M4057</link>
      <description>&lt;P&gt;The "show access-rulebase" command has an option to filter in a similar manner as packet mode in Smartconsole.&lt;/P&gt;
&lt;P&gt;Using demo mode in R80.20:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;show access-rulebase name "Network" package "Corporate_Policy" filter "200.200.200.200" filter-settings.search-mode packet limit 2&lt;/LI-CODE&gt;
&lt;P&gt;Response (shortened):&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;uid: "b406b732-2437-4848-9741-6eae1f5bf112"
name: "Network"
rulebase: 
- uid: "dedb6e70-fe6c-45be-bcd3-18fab46c02dd"
  name: "Security Gateways Access"
  type: "access-section"
  from: 1
  to: 1
  rulebase: 
  - uid: "39d0e851-0f12-46c9-bd85-b402d1181fba"
    name: "Stealth rule"
    type: "access-rule"
    domain: 
      uid: "41e821a0-3720-11e3-aa6e-0800200c9fde"
      name: "SMC User"
      domain-type: "domain"
    rule-number: 2
    filter-match-details: 
    - column: "source"
      objects: 
      - "97aeb369-9aea-11d5-bd16-0090272ccb30"
   ...
    source: 
    - "97aeb369-9aea-11d5-bd16-0090272ccb30"
    source-negate: false
    destination: 
    - "4a773692-84b5-4b81-a8da-320bf64081c0"
    destination-negate: false
    service: 
    - "97aeb369-9aea-11d5-bd16-0090272ccb30"
    service-negate: false

.....&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;More information can be found using the management API documention from the following links.&lt;/P&gt;
&lt;P&gt;- &lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-access-rulebase~v1.2%20" target="_blank" rel="noopener"&gt;https://sc1.checkpoint.com/documents/latest/APIs/index.html#cli/show-access-rulebase~v1.2%20&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 21:23:06 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/65952#M4057</guid>
      <dc:creator>masher</dc:creator>
      <dc:date>2019-10-25T21:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/65954#M4058</link>
      <description>&lt;P&gt;Thanks, I'm looking for something human-readable. Is there a way to see the rules over the CLI?&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 21:48:02 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/65954#M4058</guid>
      <dc:creator>C_M</dc:creator>
      <dc:date>2019-10-25T21:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/65958#M4059</link>
      <description>All the API calls can be made over CLI.&lt;BR /&gt;However, the output is like above.&lt;BR /&gt;You can have mgmt_cli output in JSON then use jq to parse the output a bit, giving you only the information you want.</description>
      <pubDate>Sat, 26 Oct 2019 01:33:02 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/65958#M4059</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-10-26T01:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71138#M4236</link>
      <description>&lt;P&gt;Is there any easy way how to "convert" UIDs to names? In "show access-rulebase" there are all data, but for example source names are listed as uid, instead of names.&lt;/P&gt;
&lt;P&gt;I am aware of "show object" command, but in case I have 100 sources...&lt;/P&gt;
&lt;P&gt;The only idea I have is to check UID of specific rule and show the content via "show access-rule".&lt;/P&gt;
&lt;P&gt;Any better way possible?&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2019 20:11:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71138#M4236</guid>
      <dc:creator>JozkoMrkvicka</dc:creator>
      <dc:date>2019-12-23T20:11:26Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71139#M4237</link>
      <description>You can try adding a details-level full to the command to see if it gives you the name as well.</description>
      <pubDate>Mon, 23 Dec 2019 20:12:35 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71139#M4237</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-12-23T20:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71146#M4238</link>
      <description>&lt;P&gt;You can add the &lt;STRONG&gt;&lt;EM&gt;&lt;FONT color="red"&gt;use-object-dictionary false&lt;/FONT&gt;&lt;/EM&gt; &lt;/STRONG&gt;option to include the names object names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[admin@vMgmt01]# mgmt_cli -s session.id show access-rulebase name "gw01 Network" offset 12 limit 1 &lt;STRONG&gt;use-object-dictionary false&lt;/STRONG&gt;&lt;BR /&gt;uid: "5bfb5361-84d8-4b55-a0b6-a1c309dab52b"&lt;BR /&gt;name: "gw01 Network"&lt;BR /&gt;rulebase:&lt;BR /&gt;- uid: "2ca377fb-003e-4890-99fa-6128112083a8"&lt;BR /&gt;name: "Allowed Internet Access"&lt;BR /&gt;type: "access-section"&lt;BR /&gt;from: 13&lt;BR /&gt;to: 13&lt;BR /&gt;rulebase:&lt;BR /&gt;- uid: "49e3ebbd-9761-4381-8951-ec2972f517a3"&lt;BR /&gt;name: "HTTP/HTTPS"&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;...&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;source:&lt;BR /&gt;- uid: "fb7f60bd-d4df-4f2d-adf8-664251f8954a"&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;name: "NET-10.22.33.0"&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;type: "network"&lt;BR /&gt;domain:&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;...&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;service:&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;- uid: "97aeb3d4-9aea-11d5-bd16-0090272ccb30"&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="red"&gt;&lt;STRONG&gt;name: "http"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;type: "service-tcp"&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;domain:&lt;BR /&gt;uid: "a0bbbc99-adef-4ef8-bb6d-defdefdefdef"&lt;BR /&gt;name: "Check Point Data"&lt;BR /&gt;domain-type: "data domain"&lt;BR /&gt;port: "80"&lt;BR /&gt;- uid: "97aeb443-9aea-11d5-bd16-0090272ccb30"&lt;BR /&gt;&lt;EM&gt;&lt;FONT color="red"&gt;&lt;STRONG&gt;name: "https"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;type: "service-tcp"&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;... &lt;/STRONG&gt;&lt;/EM&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Dec 2019 21:01:29 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71146#M4238</guid>
      <dc:creator>masher</dc:creator>
      <dc:date>2019-12-23T21:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71150#M4242</link>
      <description>Thanks for the hint, Masher !&lt;BR /&gt;Exactly what I was looking for &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 23 Dec 2019 22:37:00 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71150#M4242</guid>
      <dc:creator>JozkoMrkvicka</dc:creator>
      <dc:date>2019-12-23T22:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71151#M4243</link>
      <description>full details-level wont give you the names. I also expected that, but this is not the case. &lt;BR /&gt;&lt;BR /&gt;Hint from Masher is correct way - you need to use "use-object-dictionary false" parameter to give you the name.</description>
      <pubDate>Mon, 23 Dec 2019 22:40:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/71151#M4243</guid>
      <dc:creator>JozkoMrkvicka</dc:creator>
      <dc:date>2019-12-23T22:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/82118#M4736</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use&amp;nbsp;&lt;/P&gt;&lt;P&gt;use-object-dictionary as false but still&amp;nbsp; object name&amp;nbsp; is not coming&amp;nbsp; only getting uid ,can any one help me .&lt;/P&gt;&lt;P&gt;below the rest api and option i am using&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;url: "https://{{mserver_hostname}}/web_api/show-access-rulebase"&lt;BR /&gt;validate_certs: False&lt;BR /&gt;method: POST&lt;BR /&gt;headers:&lt;BR /&gt;X-chkp-sid: "{{ login.json.sid }}"&lt;BR /&gt;body:&lt;BR /&gt;offset: 0&lt;BR /&gt;limit: 20&lt;BR /&gt;name: "Network"&lt;BR /&gt;use-object-dictionary: "false"&lt;BR /&gt;details-level: full&lt;/P&gt;&lt;P&gt;Appreciate&amp;nbsp; your help in advance&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 13:13:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/82118#M4736</guid>
      <dc:creator>yogesh_uit08</dc:creator>
      <dc:date>2020-04-16T13:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/82126#M4737</link>
      <description>&lt;P&gt;If you are usign this api inside a script, you can levarage on the use-object-dictionray to convert the uid to an object name, or if you prefer you can use the following api call&lt;/P&gt;&lt;PRE&gt;mgmt_cli show object uid "ef82887c-d08f-49a3-a18f-a376be633848" --format json&lt;/PRE&gt;&lt;P&gt;to get the name and type for every object you need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you share your api call and response please?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 14:35:18 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/82126#M4737</guid>
      <dc:creator>FraP</dc:creator>
      <dc:date>2020-04-16T14:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/82989#M4764</link>
      <description>&lt;P&gt;Thanks for your reply .&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the&amp;nbsp;use-object-dictionary true but for some object i did not get the name.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 18:54:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/82989#M4764</guid>
      <dc:creator>yogesh_uit08</dc:creator>
      <dc:date>2020-04-23T18:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/82991#M4765</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am making call to rule base api and&amp;nbsp; using filter to grab the matching rule for source destination and port.,however the issue is for some cases i am getting correct output where source destination and port is&amp;nbsp; there but in some cases i am not getting the desired result.&lt;/P&gt;&lt;P&gt;i mean all other rule coming for destination but source is not coming in output.&lt;/P&gt;&lt;P&gt;I have one query for for using filer in packet mode do we required the live traffic on the gateway. can this packet mode filter will work on rulebase database without the live traffic.?&lt;/P&gt;&lt;P&gt;My api call-&lt;/P&gt;&lt;P&gt;- name: Checking rule base for source and destiantion&lt;BR /&gt;uri:&lt;BR /&gt;url: "https://{{mserver_hostname}}/web_api/show-access-rulebase"&lt;BR /&gt;validate_certs: False&lt;BR /&gt;method: POST&lt;BR /&gt;headers:&lt;BR /&gt;x-chkp-sid: "{{ login.json.sid }}"&lt;BR /&gt;body:&lt;BR /&gt;offset: 0&lt;BR /&gt;limit: 500&lt;BR /&gt;name: "Network"&lt;BR /&gt;details-level: "full"&lt;BR /&gt;use-object-dictionary: true&lt;BR /&gt;filter: "src:10.70.101.188 AND dst:10.9.17.65 AND svc:30000 AND action:6c488338-8eec-4103-ad21-cd461ac2c472"&lt;BR /&gt;body_format: json&lt;BR /&gt;register: rule_search&lt;/P&gt;&lt;P&gt;- set_fact:&lt;BR /&gt;&amp;nbsp; rule_search_result: "{{rule_search | to_json}}"&lt;/P&gt;&lt;P&gt;- debug:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; var: rule_search_result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and how to parse the output&amp;nbsp; for specific source destination and port ?&lt;/P&gt;&lt;P&gt;Appreciate&amp;nbsp; your help in advanced . I am totally stuck over here please help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Apr 2020 19:18:08 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/82991#M4765</guid>
      <dc:creator>yogesh_uit08</dc:creator>
      <dc:date>2020-04-23T19:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/83101#M4768</link>
      <description>&lt;P&gt;What do you mean by live traffic?&lt;BR /&gt;The api call does a query for rules currently defined on the manager: your gateway could have a different version of the rulebase, if you edited it and not installed...&lt;BR /&gt;&lt;BR /&gt;For sure, you can achieve the "rule lookup", using packed mode and the filter-setting(take a look to the API guide)...&lt;BR /&gt;In case you need to resolve ie the "uid" for the action object, i suggest you to use the api call "show object" with the uid as input&lt;BR /&gt;&lt;BR /&gt;For specifc issue, please share a picture of want you want &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 18:43:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/83101#M4768</guid>
      <dc:creator>FraP</dc:creator>
      <dc:date>2020-04-24T18:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: API call to see if rule already exists</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/84991#M4857</link>
      <description>&lt;P&gt;Thanks Nickel for your reply.&lt;/P&gt;&lt;P&gt;however what I have observed whenever i am using the packet&amp;nbsp; mode&amp;nbsp; and filter the source destination and port&amp;nbsp; not getting the consistent output . that is the main issue.&lt;/P&gt;&lt;P&gt;I am querying the rulebase base API and applying the below mentioned filter&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;filter: "src:10.70.101.188 AND dst:10.9.17.65 AND svc:30000 AND action:6c488338-8eec-4103-ad21-cd461ac2c472"&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 May 2020 22:51:04 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-call-to-see-if-rule-already-exists/m-p/84991#M4857</guid>
      <dc:creator>yogesh_uit08</dc:creator>
      <dc:date>2020-05-12T22:51:04Z</dc:date>
    </item>
  </channel>
</rss>

