<?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: Check if Object Exists for IP Subnet/CIDR in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108620#M5526</link>
    <description>&lt;P&gt;Thanks, that was a copy paste, typo was the culprit.&lt;/P&gt;&lt;P&gt;Since I wanted only network type objects for "10.63.127.0/24", I went with following -&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;LI-CODE lang="javascript"&gt;mgmt_cli -r true show objects filter "10.63.127.0/24" -f json -s id.txt | jq '.objects[] | select(.type == "network")'&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 23 Jan 2021 21:50:10 GMT</pubDate>
    <dc:creator>Manu_Pillai</dc:creator>
    <dc:date>2021-01-23T21:50:10Z</dc:date>
    <item>
      <title>Check if Object Exists for IP Subnet/CIDR</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108249#M5502</link>
      <description>&lt;P&gt;Objective : Check if there is an object for 10.63.127.0/24 ?&lt;/P&gt;&lt;P&gt;As far as I understand, we need use "show-objects" with filter for Network Subnet and mask length.&lt;/P&gt;&lt;P&gt;Following brings many other objects, filter not working. Perhaps I missed something ?&lt;/P&gt;&lt;P&gt;mgmt_cli show objects order.1.ASC "name" type "network" filter "subnet4: 10.63.127.0 AND mask-length4: 24" --format json -s id.txt&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2021 04:48:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108249#M5502</guid>
      <dc:creator>Manu_Pillai</dc:creator>
      <dc:date>2021-01-20T04:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Check if Object Exists for IP Subnet/CIDR</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108412#M5515</link>
      <description>&lt;P&gt;It seems you are searching for objects of type&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;network&lt;/STRONG&gt;&lt;/EM&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;that match the criteria. If you want to search for all objects, just omit the&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;type&lt;/STRONG&gt;&lt;/EM&gt; parameter. Also, no need to specify type of object in the filter, you can use CIDR notation directly:&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;10.63.127.0/24&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;If you are looking for all objects but of&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;network&lt;/STRONG&gt;&lt;/EM&gt; type:&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;mgmt_cli -r true show objects filter "10.63.127.0/24" -f json | jq '.objects[] | select(.type != "network")'&lt;/LI-CODE&gt;
&lt;P&gt;Use JQ to filter out all you don't need as a type.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 14:45:06 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108412#M5515</guid>
      <dc:creator>Art_Zalenekas</dc:creator>
      <dc:date>2021-01-21T14:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Check if Object Exists for IP Subnet/CIDR</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108449#M5517</link>
      <description>&lt;P&gt;My objective is to get matching objects for IPv4 network&amp;nbsp;&lt;SPAN&gt;10.63.127.0 with CIDR 24 or subnet mask 255.255.255.0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried the following (matching Network) based on your example, NO LUCK&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;mgmt_cli -r true show objects filter "10.63.127.0/24" -f json | jq '.objects[] | select(.type == "network")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2021 22:06:20 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108449#M5517</guid>
      <dc:creator>Manu_Pillai</dc:creator>
      <dc:date>2021-01-21T22:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Check if Object Exists for IP Subnet/CIDR</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108615#M5525</link>
      <description>&lt;P&gt;You are missing a single quote at the end for your JQ query.&lt;BR /&gt;If you are trying to get all objects based on that filter, then you don't have to filter out for the object type&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;network&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;anymore&lt;EM&gt;.&lt;/EM&gt; Just execute the command without the JQ query. You can apply JQ to show only specific fields of interest, like&amp;nbsp;&lt;EM&gt;name&lt;/EM&gt;,&amp;nbsp;&lt;EM&gt;type,&lt;/EM&gt; and&amp;nbsp;&lt;EM&gt;uid.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Jan 2021 20:41:06 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108615#M5525</guid>
      <dc:creator>Art_Zalenekas</dc:creator>
      <dc:date>2021-01-23T20:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: Check if Object Exists for IP Subnet/CIDR</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108620#M5526</link>
      <description>&lt;P&gt;Thanks, that was a copy paste, typo was the culprit.&lt;/P&gt;&lt;P&gt;Since I wanted only network type objects for "10.63.127.0/24", I went with following -&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;LI-CODE lang="javascript"&gt;mgmt_cli -r true show objects filter "10.63.127.0/24" -f json -s id.txt | jq '.objects[] | select(.type == "network")'&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 23 Jan 2021 21:50:10 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-if-Object-Exists-for-IP-Subnet-CIDR/m-p/108620#M5526</guid>
      <dc:creator>Manu_Pillai</dc:creator>
      <dc:date>2021-01-23T21:50:10Z</dc:date>
    </item>
  </channel>
</rss>

