<?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 How To's - Interact with Check Point Management API on Gaia R81 in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106320#M5421</link>
    <description>&lt;P&gt;Hi there, in this post we’re going to see how to interact with Check Point Management API. We are going to run some API commands using GAIA CLI (clish), Windows CLI and SmartConsole CLI.&lt;/P&gt;&lt;P&gt;Before starting, be sure to enable to enable API on &lt;STRONG&gt;SmartConsole &amp;gt; Manage &amp;amp; Settings &amp;gt; Blades &amp;gt; Management API &amp;gt; Advanced Settings &amp;gt; Accept call from: All IP addresses&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9903i64C8AF1C5C895273/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This change requires us to restart the api service. Login into management server and restart the api service by running the command&lt;STRONG&gt; api restart&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.png" style="width: 394px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9904i74181CB6800F462C/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After some minutes we can verify the api status service by running the command &lt;STRONG&gt;api status&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.png" style="width: 726px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9905i342ECC36B6F0D7BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.png" alt="3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As we are already at Gaia clish, we’ll begin performing some operations here.&lt;/P&gt;&lt;P&gt;First we have to log in as a management user by running the command &lt;STRONG&gt;mgmt login&lt;/STRONG&gt;. Another variation for this command is to use &lt;STRONG&gt;mgmt login&lt;/STRONG&gt; without the&lt;STRONG&gt; user&lt;/STRONG&gt; argument, but for some reason the authentication failed.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="4.png" style="width: 315px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9906iB1EEBEB400895E4B/image-size/large?v=v2&amp;amp;px=999" role="button" title="4.png" alt="4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To use api commands the syntax is&lt;STRONG&gt; mgmt&amp;nbsp;+ command + parameters&lt;/STRONG&gt;. For example let’s list all the network objects by running the command&amp;nbsp;&lt;STRONG&gt;mgmt show-networks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9907i6E9F488212940ED6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="5.png" alt="5.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The result is printed in json format. This means that we can leverage this output using python (I'll right more about this in the future).&lt;/P&gt;&lt;P&gt;Let’s change the DMZ network name, by running the command &lt;STRONG&gt;mgmt set network name DMZ new-name DMZ-API color “blue”&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="6.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9908iF4E4226C67016784/image-size/large?v=v2&amp;amp;px=999" role="button" title="6.png" alt="6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When we change an object value, the object will be locked for the current session until we publish the change.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="7.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9909i4DE365ADB06247C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="7.png" alt="7.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let’s publish the change by running the command&amp;nbsp;&lt;STRONG&gt;mgmt publish&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="8.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9911i6DA4ECBE419DAA44/image-size/medium?v=v2&amp;amp;px=400" role="button" title="8.png" alt="8.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And we have success. Let’s verify by running the command &lt;STRONG&gt;mgmt show network name DMZ-API&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="9.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9912i9B3B37A4AFA458E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="9.png" alt="9.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We can also verify by looking at SmartConsole&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="10.png" style="width: 203px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9913iA5B1E31676AFBF10/image-size/large?v=v2&amp;amp;px=999" role="button" title="10.png" alt="10.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now let's install a policy by running the command &lt;STRONG&gt;mgmt install-policy policy-package MainSite access true threat-prevention true targets.1 A-GW-CLUSTER&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="11.png" style="width: 863px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9914i304F3BDE16C0FF33/image-size/large?v=v2&amp;amp;px=999" role="button" title="11.png" alt="11.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We should get a successful result&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="12.png" style="width: 423px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9915i0D9775AA225BBA9E/image-size/large?v=v2&amp;amp;px=999" role="button" title="12.png" alt="12.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="13.png" style="width: 791px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9916i36BCEFF0C89EA39E/image-size/large?v=v2&amp;amp;px=999" role="button" title="13.png" alt="13.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Windows cli console&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Now let’s run some commands using windows cli console. We’ll have to use the Check Point tool mgmt_cli.exe, located in &lt;STRONG&gt;C:\Program Files (x86)\CheckPoint\SmartConsole\R81\PROGRAM folder.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When using the mgmt_cli tool, in order for a command to run, it is mandatory to provide login credentials or use a session-id token that was obtained previously using the ‘login’ command.&lt;/P&gt;&lt;P&gt;Let’s login into mgmt_server by running the command &lt;STRONG&gt;mgmt_cli login –u silesio –p admin1234 –m 192.168.234.11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="14.png" style="width: 937px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9917iBD5261BC038269AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="14.png" alt="14.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now let’s see all the hosts by running the command &lt;STRONG&gt;mgmt_cli show hosts –u silesio –p admin1234 –m 192.168.234.11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="15.png" style="width: 978px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9918i72B7907BA1087584/image-size/large?v=v2&amp;amp;px=999" role="button" title="15.png" alt="15.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Calling mgmt_cli with credentials (provided explicitly or entered by prompt) will result in performing four different operations:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Log into the management server using the supplied credentials&lt;/LI&gt;&lt;LI&gt;Execute the command&lt;/LI&gt;&lt;LI&gt;Publish&lt;/LI&gt;&lt;LI&gt;Logout&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Let’s delete the host &lt;STRONG&gt;H_192.168.20.1&lt;/STRONG&gt; by running the command &lt;STRONG&gt;mgmt_cli delete host name H_192.168.20.1 –u silesio –p admin1234 –m 192.168.234.11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="16.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9919i662CDC4470135A75/image-size/large?v=v2&amp;amp;px=999" role="button" title="16.png" alt="16.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We can also run the commands without specifying the credentials all the time. Let’s create a file to store the session and use it whenever we want to run a command.&lt;/P&gt;&lt;P&gt;Open the windows prompt as administrator.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="17.png" style="width: 352px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9920iD084B09BA6C98BA8/image-size/large?v=v2&amp;amp;px=999" role="button" title="17.png" alt="17.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Type the command &lt;STRONG&gt;mgmt_cli –u silesio –p admin1234 –m 192.168.234.11 &amp;gt; session.txt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="18.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9921i3BC9EFC9951C7C78/image-size/large?v=v2&amp;amp;px=999" role="button" title="18.png" alt="18.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Let’s add a new host by running the command&lt;STRONG&gt; mgmt_cli add host name "New Host API" ip-address 172.30.30.1 color green -s session.txt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="19.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9922i333B44B52967060B/image-size/large?v=v2&amp;amp;px=999" role="button" title="19.png" alt="19.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Notice that the change, wasn’t published. In the above example, the output from the login command is redirected to a file called "session.txt". By using the "&lt;STRONG&gt;-s&lt;/STRONG&gt;" parameter, the rest of the commands read "session.txt" and automatically extract the session-id from this file.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20.png" style="width: 730px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9923iB171545A8BAAFF9E/image-size/large?v=v2&amp;amp;px=999" role="button" title="20.png" alt="20.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We can confirm the new host was created successfully.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="21.png" style="width: 209px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9924i7E27485757D8BF16/image-size/large?v=v2&amp;amp;px=999" role="button" title="21.png" alt="21.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;SmartConsole CLI&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Lastly, let’s use the SmartConsole CLI.&lt;/P&gt;&lt;P&gt;When typing commands inside the window they just work - There is no need to provide a username, password or the ip-address of the management server because this information was already provided in the GUI’s login dialog and the commands are executed in that context.&lt;/P&gt;&lt;P&gt;The syntax is identical to the commands used previously. The main difference, here we don’t have to add&lt;STRONG&gt; mgmt&lt;/STRONG&gt; command.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="22.png" style="width: 388px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9925i7A6A18C0AD42DD3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="22.png" alt="22.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let’s add two groups, and a new network inside of one of the groups.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="23.png" style="width: 334px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9931iC993873EE6DEC19C/image-size/large?v=v2&amp;amp;px=999" role="button" title="23.png" alt="23.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="24.png" style="width: 795px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9927iC1F90EC8A6F4DD45/image-size/large?v=v2&amp;amp;px=999" role="button" title="24.png" alt="24.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="25.png" style="width: 604px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9928i8D4DBB50F5D9DDF7/image-size/large?v=v2&amp;amp;px=999" role="button" title="25.png" alt="25.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To save the changes we have to publish.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="26.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9929iD7A9594DA9481D2D/image-size/large?v=v2&amp;amp;px=999" role="button" title="26.png" alt="26.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It appears that the publish command isn’t supported inside SmartConsole CLI, so we have publish manually.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="27.png" style="width: 418px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9930iC9894C6C4E2AAA62/image-size/large?v=v2&amp;amp;px=999" role="button" title="27.png" alt="27.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are some of the commands that we can use to interact with Check Point Management API. They are more helpful for bulk operations like adding more than 100 objects, or even to automate some repetitive tasks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you enjoyed this post, leave your comments below and I'll see you on the next one.&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;P data-unlink="true"&gt;https:// sc1.checkpoint.com/documents/latest/APIs/index.html#cli/introduction~v1.7%20&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Dec 2020 20:30:29 GMT</pubDate>
    <dc:creator>Silesio</dc:creator>
    <dc:date>2020-12-23T20:30:29Z</dc:date>
    <item>
      <title>How To's - Interact with Check Point Management API on Gaia R81</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106320#M5421</link>
      <description>&lt;P&gt;Hi there, in this post we’re going to see how to interact with Check Point Management API. We are going to run some API commands using GAIA CLI (clish), Windows CLI and SmartConsole CLI.&lt;/P&gt;&lt;P&gt;Before starting, be sure to enable to enable API on &lt;STRONG&gt;SmartConsole &amp;gt; Manage &amp;amp; Settings &amp;gt; Blades &amp;gt; Management API &amp;gt; Advanced Settings &amp;gt; Accept call from: All IP addresses&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9903i64C8AF1C5C895273/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.png" alt="1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This change requires us to restart the api service. Login into management server and restart the api service by running the command&lt;STRONG&gt; api restart&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.png" style="width: 394px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9904i74181CB6800F462C/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.png" alt="2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;After some minutes we can verify the api status service by running the command &lt;STRONG&gt;api status&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.png" style="width: 726px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9905i342ECC36B6F0D7BB/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.png" alt="3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As we are already at Gaia clish, we’ll begin performing some operations here.&lt;/P&gt;&lt;P&gt;First we have to log in as a management user by running the command &lt;STRONG&gt;mgmt login&lt;/STRONG&gt;. Another variation for this command is to use &lt;STRONG&gt;mgmt login&lt;/STRONG&gt; without the&lt;STRONG&gt; user&lt;/STRONG&gt; argument, but for some reason the authentication failed.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="4.png" style="width: 315px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9906iB1EEBEB400895E4B/image-size/large?v=v2&amp;amp;px=999" role="button" title="4.png" alt="4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To use api commands the syntax is&lt;STRONG&gt; mgmt&amp;nbsp;+ command + parameters&lt;/STRONG&gt;. For example let’s list all the network objects by running the command&amp;nbsp;&lt;STRONG&gt;mgmt show-networks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9907i6E9F488212940ED6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="5.png" alt="5.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The result is printed in json format. This means that we can leverage this output using python (I'll right more about this in the future).&lt;/P&gt;&lt;P&gt;Let’s change the DMZ network name, by running the command &lt;STRONG&gt;mgmt set network name DMZ new-name DMZ-API color “blue”&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="6.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9908iF4E4226C67016784/image-size/large?v=v2&amp;amp;px=999" role="button" title="6.png" alt="6.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When we change an object value, the object will be locked for the current session until we publish the change.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="7.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9909i4DE365ADB06247C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="7.png" alt="7.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let’s publish the change by running the command&amp;nbsp;&lt;STRONG&gt;mgmt publish&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="8.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9911i6DA4ECBE419DAA44/image-size/medium?v=v2&amp;amp;px=400" role="button" title="8.png" alt="8.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And we have success. Let’s verify by running the command &lt;STRONG&gt;mgmt show network name DMZ-API&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="9.png" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9912i9B3B37A4AFA458E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="9.png" alt="9.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We can also verify by looking at SmartConsole&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="10.png" style="width: 203px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9913iA5B1E31676AFBF10/image-size/large?v=v2&amp;amp;px=999" role="button" title="10.png" alt="10.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Now let's install a policy by running the command &lt;STRONG&gt;mgmt install-policy policy-package MainSite access true threat-prevention true targets.1 A-GW-CLUSTER&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="11.png" style="width: 863px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9914i304F3BDE16C0FF33/image-size/large?v=v2&amp;amp;px=999" role="button" title="11.png" alt="11.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We should get a successful result&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="12.png" style="width: 423px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9915i0D9775AA225BBA9E/image-size/large?v=v2&amp;amp;px=999" role="button" title="12.png" alt="12.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="13.png" style="width: 791px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9916i36BCEFF0C89EA39E/image-size/large?v=v2&amp;amp;px=999" role="button" title="13.png" alt="13.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;Windows cli console&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Now let’s run some commands using windows cli console. We’ll have to use the Check Point tool mgmt_cli.exe, located in &lt;STRONG&gt;C:\Program Files (x86)\CheckPoint\SmartConsole\R81\PROGRAM folder.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;When using the mgmt_cli tool, in order for a command to run, it is mandatory to provide login credentials or use a session-id token that was obtained previously using the ‘login’ command.&lt;/P&gt;&lt;P&gt;Let’s login into mgmt_server by running the command &lt;STRONG&gt;mgmt_cli login –u silesio –p admin1234 –m 192.168.234.11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="14.png" style="width: 937px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9917iBD5261BC038269AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="14.png" alt="14.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now let’s see all the hosts by running the command &lt;STRONG&gt;mgmt_cli show hosts –u silesio –p admin1234 –m 192.168.234.11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="15.png" style="width: 978px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9918i72B7907BA1087584/image-size/large?v=v2&amp;amp;px=999" role="button" title="15.png" alt="15.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Calling mgmt_cli with credentials (provided explicitly or entered by prompt) will result in performing four different operations:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Log into the management server using the supplied credentials&lt;/LI&gt;&lt;LI&gt;Execute the command&lt;/LI&gt;&lt;LI&gt;Publish&lt;/LI&gt;&lt;LI&gt;Logout&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Let’s delete the host &lt;STRONG&gt;H_192.168.20.1&lt;/STRONG&gt; by running the command &lt;STRONG&gt;mgmt_cli delete host name H_192.168.20.1 –u silesio –p admin1234 –m 192.168.234.11&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="16.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9919i662CDC4470135A75/image-size/large?v=v2&amp;amp;px=999" role="button" title="16.png" alt="16.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We can also run the commands without specifying the credentials all the time. Let’s create a file to store the session and use it whenever we want to run a command.&lt;/P&gt;&lt;P&gt;Open the windows prompt as administrator.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="17.png" style="width: 352px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9920iD084B09BA6C98BA8/image-size/large?v=v2&amp;amp;px=999" role="button" title="17.png" alt="17.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Type the command &lt;STRONG&gt;mgmt_cli –u silesio –p admin1234 –m 192.168.234.11 &amp;gt; session.txt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="18.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9921i3BC9EFC9951C7C78/image-size/large?v=v2&amp;amp;px=999" role="button" title="18.png" alt="18.png" /&gt;&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Let’s add a new host by running the command&lt;STRONG&gt; mgmt_cli add host name "New Host API" ip-address 172.30.30.1 color green -s session.txt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="19.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9922i333B44B52967060B/image-size/large?v=v2&amp;amp;px=999" role="button" title="19.png" alt="19.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Notice that the change, wasn’t published. In the above example, the output from the login command is redirected to a file called "session.txt". By using the "&lt;STRONG&gt;-s&lt;/STRONG&gt;" parameter, the rest of the commands read "session.txt" and automatically extract the session-id from this file.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20.png" style="width: 730px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9923iB171545A8BAAFF9E/image-size/large?v=v2&amp;amp;px=999" role="button" title="20.png" alt="20.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;We can confirm the new host was created successfully.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="21.png" style="width: 209px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9924i7E27485757D8BF16/image-size/large?v=v2&amp;amp;px=999" role="button" title="21.png" alt="21.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;SmartConsole CLI&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Lastly, let’s use the SmartConsole CLI.&lt;/P&gt;&lt;P&gt;When typing commands inside the window they just work - There is no need to provide a username, password or the ip-address of the management server because this information was already provided in the GUI’s login dialog and the commands are executed in that context.&lt;/P&gt;&lt;P&gt;The syntax is identical to the commands used previously. The main difference, here we don’t have to add&lt;STRONG&gt; mgmt&lt;/STRONG&gt; command.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="22.png" style="width: 388px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9925i7A6A18C0AD42DD3A/image-size/large?v=v2&amp;amp;px=999" role="button" title="22.png" alt="22.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let’s add two groups, and a new network inside of one of the groups.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="23.png" style="width: 334px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9931iC993873EE6DEC19C/image-size/large?v=v2&amp;amp;px=999" role="button" title="23.png" alt="23.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="24.png" style="width: 795px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9927iC1F90EC8A6F4DD45/image-size/large?v=v2&amp;amp;px=999" role="button" title="24.png" alt="24.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="25.png" style="width: 604px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9928i8D4DBB50F5D9DDF7/image-size/large?v=v2&amp;amp;px=999" role="button" title="25.png" alt="25.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;To save the changes we have to publish.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="26.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9929iD7A9594DA9481D2D/image-size/large?v=v2&amp;amp;px=999" role="button" title="26.png" alt="26.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;It appears that the publish command isn’t supported inside SmartConsole CLI, so we have publish manually.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="27.png" style="width: 418px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/9930iC9894C6C4E2AAA62/image-size/large?v=v2&amp;amp;px=999" role="button" title="27.png" alt="27.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are some of the commands that we can use to interact with Check Point Management API. They are more helpful for bulk operations like adding more than 100 objects, or even to automate some repetitive tasks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you enjoyed this post, leave your comments below and I'll see you on the next one.&lt;/P&gt;&lt;P&gt;Reference:&lt;/P&gt;&lt;P data-unlink="true"&gt;https:// sc1.checkpoint.com/documents/latest/APIs/index.html#cli/introduction~v1.7%20&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 20:30:29 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106320#M5421</guid>
      <dc:creator>Silesio</dc:creator>
      <dc:date>2020-12-23T20:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: How To's - Interact with Check Point Management API on Gaia R81</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106323#M5423</link>
      <description>&lt;P&gt;This got posted twice…what happened to cause that?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2020 21:06:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106323#M5423</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-12-23T21:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: How To's - Interact with Check Point Management API on Gaia R81</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106328#M5425</link>
      <description>&lt;P&gt;Probably an error while posting. I think this happens whenever there is a link in the post.&lt;/P&gt;&lt;P&gt;If you noticed, I had to add a blank space in the url.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Dec 2020 00:13:57 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106328#M5425</guid>
      <dc:creator>Silesio</dc:creator>
      <dc:date>2020-12-24T00:13:57Z</dc:date>
    </item>
    <item>
      <title>Re: How To's - Interact with Check Point Management API on Gaia R81</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106331#M5427</link>
      <description>&lt;P&gt;That shouldn’t cause an error…&lt;/P&gt;</description>
      <pubDate>Thu, 24 Dec 2020 01:59:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/How-To-s-Interact-with-Check-Point-Management-API-on-Gaia-R81/m-p/106331#M5427</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-12-24T01:59:03Z</dc:date>
    </item>
  </channel>
</rss>

