<?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 Coffee breaks with REST - Episode #5: Private CLI Passthrough in ONTAP Rest API Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Coffee-breaks-with-REST-Episode-5-Private-CLI-Passthrough/m-p/435293#M313</link>
    <description>&lt;P&gt;&amp;nbsp; &amp;nbsp; In &lt;A href="https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Coffee-breaks-with-REST-Episode-4-ONTAPI-ZAPI-Reporting-tool/m-p/433200/highlight/true#M294" target="_blank" rel="noopener"&gt;the previous episode #4&lt;/A&gt;&amp;nbsp;, we discussed the programmatic way to find the ONTAPI (ZAPI) usage against a cluster and to find the equivalent ONTAP® REST APIs for ONTAPI calls. In this episode, we look at how private CLI passthrough can be leveraged for ONTAPI to REST gaps.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="helvetica" color="#3366FF"&gt;&lt;STRONG&gt;What is private CLI passthrough? &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A CLI command can be executed as an ONTAP REST API call. In order to execute the advanced and diagnostic mode commands, or to get advanced attributes as per use cases, users can drill down to the CLI to execute the commands. This option helps many customers and partners to address the existing ONTAPI to REST APIs gaps in completing their automation story.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="helvetica" color="#3366FF"&gt;How does it work?&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Verbs used in the CLI for create, show, update, and delete operations map to corresponding http methods, as shown in the following table. (See “A simple&amp;nbsp; example,” below, in which &lt;EM&gt;show&lt;/EM&gt; in CLI gets converted to a GET call in REST APIs.)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE width="293"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;CLI Verb&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;REST APIs Verb&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;Show&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;GET&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;Create&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;POST&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;Modify&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;PATCH&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;Delete&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;DELETE&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any space in a full CLI command becomes a forward slash in this private REST API endpoint, with the default prefix&amp;nbsp;&lt;FONT size="4" color="#993366"&gt;&lt;STRONG&gt;/api/private/cli/&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Syntax&lt;/U&gt;&lt;/STRONG&gt;:&amp;nbsp;&amp;nbsp; &lt;FONT color="#993366"&gt;/api/private/cli/&lt;/FONT&gt;&amp;lt;&amp;lt;CLI&amp;gt;&amp;gt;/&amp;lt;&amp;lt;Command&amp;gt;&amp;gt;/&amp;lt;&amp;lt;given&amp;gt;&amp;gt;/&amp;lt;&amp;lt;this&amp;gt;&amp;gt;/&amp;lt;&amp;lt;way&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="helvetica" color="#3366FF"&gt;&lt;STRONG&gt;Limitations of CLI passthrough &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLI passthrough is an advanced approach that helps customers and partners to execute even advanced and diagnostic mode commands in CLI. However, there are certain restrictions in CLI passthrough. The primary limitation is that private CLI passthrough doesn't handle any “systemshell”, “node run”, or “statistics” commands, or any commands that ask for non confirmation user input, like passwords. Any command that requires interactive input that doesn't have an alternative way to pass that data, like a hidden parameter, will fail. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;&lt;U&gt;&lt;STRONG&gt;Simple example&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; The following CLI command with a space gets replaced by a forward slash, and show turns into a GET call in REST code (Note the &lt;FONT color="#333399"&gt;color&lt;/FONT&gt; indications for better understanding.) Since it’s a CLI command, /api/private/cli is a prefix in http call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#333399"&gt;CLI Command:&lt;/FONT&gt; &amp;gt;&amp;gt; &lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&lt;FONT color="#993366"&gt;System node power&lt;/FONT&gt; &lt;FONT color="#FF6600"&gt;show&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;def get_system_node_power(cluster, headers_inc):&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; "&lt;EM&gt;Get system node power CLI command&lt;/EM&gt;"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;cmd = "&lt;FONT color="#333399"&gt;api/private/cli&lt;/FONT&gt;/&lt;FONT color="#993366"&gt;system/node/power&lt;/FONT&gt;"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;url = "https://{}/{}?fields=node,status”.format&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;(cluster, cmd)&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;&lt;BR /&gt;&amp;nbsp;print(url)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;response = requests.&lt;FONT color="#FF6600"&gt;get&lt;/FONT&gt; (url, headers=headers_inc, verify=False)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;return response.json()&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;&lt;STRONG&gt;&lt;U&gt;&lt;FONT face="helvetica" size="4" color="#3366FF"&gt;Resources&lt;/FONT&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/H2&gt;&lt;OL&gt;&lt;LI&gt;Sample scripts: &lt;A href="https://github.com/NetApp/ontap-rest-python/tree/master/examples/rest_api/cli_passthrough_samples" target="_blank" rel="noopener"&gt;Private CLI Passthrough examples published in GitHub site&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Documentation: For more information and examples, go to the&amp;nbsp;&lt;A href="https://library.netapp.com/ecmdocs/ECMLP2882307/html/index.html" target="_blank" rel="noopener"&gt;Using Private CLI Passthrough section&lt;/A&gt; under ONTAP REST APIs features.&lt;/LI&gt;&lt;LI&gt;Blog:&lt;A href="https://netapp.io/2020/11/09/private-cli-passthrough-ontap-rest-api/" target="_blank" rel="noopener"&gt; &lt;SPAN&gt;Using Private CLI Passthrough&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Wed, 04 Jun 2025 10:00:15 GMT</pubDate>
    <dc:creator>qw</dc:creator>
    <dc:date>2025-06-04T10:00:15Z</dc:date>
    <item>
      <title>Coffee breaks with REST - Episode #5: Private CLI Passthrough</title>
      <link>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Coffee-breaks-with-REST-Episode-5-Private-CLI-Passthrough/m-p/435293#M313</link>
      <description>&lt;P&gt;&amp;nbsp; &amp;nbsp; In &lt;A href="https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Coffee-breaks-with-REST-Episode-4-ONTAPI-ZAPI-Reporting-tool/m-p/433200/highlight/true#M294" target="_blank" rel="noopener"&gt;the previous episode #4&lt;/A&gt;&amp;nbsp;, we discussed the programmatic way to find the ONTAPI (ZAPI) usage against a cluster and to find the equivalent ONTAP® REST APIs for ONTAPI calls. In this episode, we look at how private CLI passthrough can be leveraged for ONTAPI to REST gaps.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="helvetica" color="#3366FF"&gt;&lt;STRONG&gt;What is private CLI passthrough? &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A CLI command can be executed as an ONTAP REST API call. In order to execute the advanced and diagnostic mode commands, or to get advanced attributes as per use cases, users can drill down to the CLI to execute the commands. This option helps many customers and partners to address the existing ONTAPI to REST APIs gaps in completing their automation story.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="helvetica" color="#3366FF"&gt;How does it work?&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Verbs used in the CLI for create, show, update, and delete operations map to corresponding http methods, as shown in the following table. (See “A simple&amp;nbsp; example,” below, in which &lt;EM&gt;show&lt;/EM&gt; in CLI gets converted to a GET call in REST APIs.)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE width="293"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;CLI Verb&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;REST APIs Verb&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;Show&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;GET&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;Create&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;POST&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;Modify&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;PATCH&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="130"&gt;&lt;P&gt;Delete&lt;/P&gt;&lt;/TD&gt;&lt;TD width="162"&gt;&lt;P&gt;DELETE&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any space in a full CLI command becomes a forward slash in this private REST API endpoint, with the default prefix&amp;nbsp;&lt;FONT size="4" color="#993366"&gt;&lt;STRONG&gt;/api/private/cli/&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Syntax&lt;/U&gt;&lt;/STRONG&gt;:&amp;nbsp;&amp;nbsp; &lt;FONT color="#993366"&gt;/api/private/cli/&lt;/FONT&gt;&amp;lt;&amp;lt;CLI&amp;gt;&amp;gt;/&amp;lt;&amp;lt;Command&amp;gt;&amp;gt;/&amp;lt;&amp;lt;given&amp;gt;&amp;gt;/&amp;lt;&amp;lt;this&amp;gt;&amp;gt;/&amp;lt;&amp;lt;way&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="helvetica" color="#3366FF"&gt;&lt;STRONG&gt;Limitations of CLI passthrough &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CLI passthrough is an advanced approach that helps customers and partners to execute even advanced and diagnostic mode commands in CLI. However, there are certain restrictions in CLI passthrough. The primary limitation is that private CLI passthrough doesn't handle any “systemshell”, “node run”, or “statistics” commands, or any commands that ask for non confirmation user input, like passwords. Any command that requires interactive input that doesn't have an alternative way to pass that data, like a hidden parameter, will fail. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699"&gt;&lt;U&gt;&lt;STRONG&gt;Simple example&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; The following CLI command with a space gets replaced by a forward slash, and show turns into a GET call in REST code (Note the &lt;FONT color="#333399"&gt;color&lt;/FONT&gt; indications for better understanding.) Since it’s a CLI command, /api/private/cli is a prefix in http call.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#333399"&gt;CLI Command:&lt;/FONT&gt; &amp;gt;&amp;gt; &lt;FONT face="courier new,courier"&gt;&lt;EM&gt;&lt;FONT color="#993366"&gt;System node power&lt;/FONT&gt; &lt;FONT color="#FF6600"&gt;show&lt;/FONT&gt;&lt;/EM&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;TABLE width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;def get_system_node_power(cluster, headers_inc):&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; "&lt;EM&gt;Get system node power CLI command&lt;/EM&gt;"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;cmd = "&lt;FONT color="#333399"&gt;api/private/cli&lt;/FONT&gt;/&lt;FONT color="#993366"&gt;system/node/power&lt;/FONT&gt;"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;url = "https://{}/{}?fields=node,status”.format&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;(cluster, cmd)&lt;/FONT&gt;&lt;FONT face="courier new,courier"&gt;&lt;BR /&gt;&amp;nbsp;print(url)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;response = requests.&lt;FONT color="#FF6600"&gt;get&lt;/FONT&gt; (url, headers=headers_inc, verify=False)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;return response.json()&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H2&gt;&lt;STRONG&gt;&lt;U&gt;&lt;FONT face="helvetica" size="4" color="#3366FF"&gt;Resources&lt;/FONT&gt;&lt;BR /&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/H2&gt;&lt;OL&gt;&lt;LI&gt;Sample scripts: &lt;A href="https://github.com/NetApp/ontap-rest-python/tree/master/examples/rest_api/cli_passthrough_samples" target="_blank" rel="noopener"&gt;Private CLI Passthrough examples published in GitHub site&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;Documentation: For more information and examples, go to the&amp;nbsp;&lt;A href="https://library.netapp.com/ecmdocs/ECMLP2882307/html/index.html" target="_blank" rel="noopener"&gt;Using Private CLI Passthrough section&lt;/A&gt; under ONTAP REST APIs features.&lt;/LI&gt;&lt;LI&gt;Blog:&lt;A href="https://netapp.io/2020/11/09/private-cli-passthrough-ontap-rest-api/" target="_blank" rel="noopener"&gt; &lt;SPAN&gt;Using Private CLI Passthrough&lt;/SPAN&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Wed, 04 Jun 2025 10:00:15 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Rest-API-Discussions/Coffee-breaks-with-REST-Episode-5-Private-CLI-Passthrough/m-p/435293#M313</guid>
      <dc:creator>qw</dc:creator>
      <dc:date>2025-06-04T10:00:15Z</dc:date>
    </item>
  </channel>
</rss>

