<?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 Check Point API Template base for CLI operations on Gaia in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-Point-API-Template-base-for-CLI-operations-on-Gaia/m-p/38381#M2283</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H2&gt;Overview&lt;/H2&gt;&lt;P&gt;This is a template you can use to create API scripts for use on Gaia in expert mode with the mgmt_cli command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Description&lt;/H2&gt;&lt;P&gt;The template includes some helpful elements to provide a date-time-group for logging operations, saving credentials operation for easy re-use with many-line scripts, and a framework to build the API script from.&lt;/P&gt;&lt;P&gt;The simple version of the template does not abstract the credential configuration to variables, instead using raw naming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Instructions&lt;/H2&gt;&lt;P&gt;This is a template and should be downloaded to your Work In Progress folder for copy-pasting as a framework for building API scripts for use on the Gaia expert shell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use, update the necessary export command lines to reflect your tastes or standards for documentation and operation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key values defined:&lt;/P&gt;&lt;P&gt;- $DATE - current date time group at time script is launched (1)&lt;/P&gt;&lt;P&gt;- $APICLIadmin - user name of the administrator account (management server) that is executing the API commands&lt;/P&gt;&lt;P&gt;- $APICLIsessionfile - full path and name of the session security file used to authenticate the API operations, allows easy execution of multiple commands without re-authentication (2.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P dir="ltr"&gt;(1) The $DATE value uses this format as currently defined "2016-06-23-1250CDT" which sorts nicely, but is my standard, so adjust as necessary.&lt;/P&gt;&lt;P&gt;(2) Current default path and file name for the session security file is the local folder where the shell executes with a file name of "id.txt"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During execution the "mgmt_cli login user $APICLIadmin &amp;gt; $APICLIsessionfile" line will prompt for the password of the administrator account identified by $APICLIadmin and then output the session security file for reference that was stored at path $APICLIsessionfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "shell meat" section is used to write your shell script API and CLI commands like the example creating a dump folder and sub-folders that would be used by the example mgmt_cli commands that are in the commented out examples section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the "shell meat" the template shows how to execute an API publish operation to publish the actions executed by the sections before it.&lt;/P&gt;&lt;P&gt;Last API operation is to logout the session, effectively invalidating the session security file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The template then executes a listing of the dump directories from the example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should make it easy to quickly build API CLI scripts for execution on the management server Gaia CLI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Improvement feedback welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Code Version&lt;/H2&gt;&lt;P&gt;Code version 1.0.7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Tested on version&lt;/H2&gt;&lt;P&gt;R80, API version 1.0, and R80 with JHF 29 applied&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 13px; color: #ff0000;"&gt;&lt;STRONG&gt;NOTICE: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.6667px; color: #999999;"&gt;&lt;STRONG&gt;By using this sample code you agree to terms and conditions in this &lt;A href="https://community.checkpoint.com/docs/DOC-1042"&gt;Not authorized to view the specified document 1042&lt;/A&gt;​&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Jun 2016 17:42:30 GMT</pubDate>
    <dc:creator>Eric_Beasley</dc:creator>
    <dc:date>2016-06-23T17:42:30Z</dc:date>
    <item>
      <title>Check Point API Template base for CLI operations on Gaia</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-Point-API-Template-base-for-CLI-operations-on-Gaia/m-p/38381#M2283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H2&gt;Overview&lt;/H2&gt;&lt;P&gt;This is a template you can use to create API scripts for use on Gaia in expert mode with the mgmt_cli command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Description&lt;/H2&gt;&lt;P&gt;The template includes some helpful elements to provide a date-time-group for logging operations, saving credentials operation for easy re-use with many-line scripts, and a framework to build the API script from.&lt;/P&gt;&lt;P&gt;The simple version of the template does not abstract the credential configuration to variables, instead using raw naming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Instructions&lt;/H2&gt;&lt;P&gt;This is a template and should be downloaded to your Work In Progress folder for copy-pasting as a framework for building API scripts for use on the Gaia expert shell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To use, update the necessary export command lines to reflect your tastes or standards for documentation and operation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Key values defined:&lt;/P&gt;&lt;P&gt;- $DATE - current date time group at time script is launched (1)&lt;/P&gt;&lt;P&gt;- $APICLIadmin - user name of the administrator account (management server) that is executing the API commands&lt;/P&gt;&lt;P&gt;- $APICLIsessionfile - full path and name of the session security file used to authenticate the API operations, allows easy execution of multiple commands without re-authentication (2.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P dir="ltr"&gt;(1) The $DATE value uses this format as currently defined "2016-06-23-1250CDT" which sorts nicely, but is my standard, so adjust as necessary.&lt;/P&gt;&lt;P&gt;(2) Current default path and file name for the session security file is the local folder where the shell executes with a file name of "id.txt"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During execution the "mgmt_cli login user $APICLIadmin &amp;gt; $APICLIsessionfile" line will prompt for the password of the administrator account identified by $APICLIadmin and then output the session security file for reference that was stored at path $APICLIsessionfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "shell meat" section is used to write your shell script API and CLI commands like the example creating a dump folder and sub-folders that would be used by the example mgmt_cli commands that are in the commented out examples section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After the "shell meat" the template shows how to execute an API publish operation to publish the actions executed by the sections before it.&lt;/P&gt;&lt;P&gt;Last API operation is to logout the session, effectively invalidating the session security file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The template then executes a listing of the dump directories from the example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should make it easy to quickly build API CLI scripts for execution on the management server Gaia CLI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Improvement feedback welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Code Version&lt;/H2&gt;&lt;P&gt;Code version 1.0.7&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H2&gt;Tested on version&lt;/H2&gt;&lt;P&gt;R80, API version 1.0, and R80 with JHF 29 applied&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 13px; color: #ff0000;"&gt;&lt;STRONG&gt;NOTICE: &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.6667px; color: #999999;"&gt;&lt;STRONG&gt;By using this sample code you agree to terms and conditions in this &lt;A href="https://community.checkpoint.com/docs/DOC-1042"&gt;Not authorized to view the specified document 1042&lt;/A&gt;​&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-align: center;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jun 2016 17:42:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Check-Point-API-Template-base-for-CLI-operations-on-Gaia/m-p/38381#M2283</guid>
      <dc:creator>Eric_Beasley</dc:creator>
      <dc:date>2016-06-23T17:42:30Z</dc:date>
    </item>
  </channel>
</rss>

