<?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: parsing  mgmt_cli using JQ delivers not expected result in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31578#M1902</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It can be in case the show-service-tcp command fails (object not found, session expired, etc.)&lt;/P&gt;&lt;P&gt;For example here is the reproduction of the issue because of expired session:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.checkpoint.com/legacyfs/online/checkpoint/66432_jq-parse-after-logout.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 17 Jun 2018 06:03:18 GMT</pubDate>
    <dc:creator>Eugene_Grybinny</dc:creator>
    <dc:date>2018-06-17T06:03:18Z</dc:date>
    <item>
      <title>parsing  mgmt_cli using JQ delivers not expected result</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31575#M1899</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;parsing &amp;nbsp;mgmt_cli using JQ delivers not expected result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am on R80.10 SMS T462 and run the following command:&lt;/P&gt;&lt;P&gt;[Expert@R80.10:0]# mgmt_cli login user admin password vpn123 &amp;gt; id.txt&lt;/P&gt;&lt;P&gt;[Expert@R80.10:0]# mgmt_cli show service-tcp -s id.txt name http --format json | jq '{name: .name, port: .port}'&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; "name": null,&lt;BR /&gt;&amp;nbsp; "port": null&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I would have expected to get the following result :&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;&amp;nbsp; "name": "http",&lt;BR /&gt;&amp;nbsp; "port": "80"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;when I run the following command I get correct results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Expert@R80.10:0]# mgmt_cli show service-tcp -s id.txt name http --format json &amp;gt; input.txt&lt;/P&gt;&lt;P&gt;[Expert@R80.10:0]# cat input.txt | jq '{name: .name, port: .port}'&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; "name": "http",&lt;BR /&gt;&amp;nbsp; "port": "80"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the input looks like follows (result of "mgmt_cli show service-tcp name http") :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;&amp;nbsp; "uid" : "97aeb3d4-9aea-11d5-bd16-0090272ccb30",&lt;BR /&gt;&amp;nbsp; "name" : "http",&lt;BR /&gt;&amp;nbsp; "type" : "service-tcp",&lt;BR /&gt;&amp;nbsp; "domain" : {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "uid" : "a0bbbc99-adef-4ef8-bb6d-defdefdefdef",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "name" : "Check Point Data",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "domain-type" : "data domain"&lt;BR /&gt;&amp;nbsp; },&lt;BR /&gt;&amp;nbsp; "port" : "80",&lt;BR /&gt;&amp;nbsp; "protocol" : "HTTP",&lt;BR /&gt;&amp;nbsp; "match-by-protocol-signature" : false,&lt;BR /&gt;&amp;nbsp; "override-default-settings" : true,&lt;BR /&gt;&amp;nbsp; "session-timeout" : 3600,&lt;BR /&gt;&amp;nbsp; "use-default-session-timeout" : true,&lt;BR /&gt;&amp;nbsp; "match-for-any" : true,&lt;BR /&gt;&amp;nbsp; "sync-connections-on-cluster" : false,&lt;BR /&gt;&amp;nbsp; "aggressive-aging" : {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "enable" : true,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "timeout" : 60,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "use-default-timeout" : false,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "default-timeout" : 60&lt;BR /&gt;&amp;nbsp; },&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I doing wrong ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 15:08:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31575#M1899</guid>
      <dc:creator>Sebastian_Gxxx</dc:creator>
      <dc:date>2018-06-15T15:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: parsing  mgmt_cli using JQ delivers not expected result</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31576#M1900</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the value output enough? example:&amp;nbsp;&amp;nbsp;&lt;BR /&gt;mgmt_cli -r true show service-tcp name http --format json|jq '.name, .port'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help us understand what the desire is, are you trying to add the attribute as a string before the value?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2018 19:06:18 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31576#M1900</guid>
      <dc:creator>Thomas_Arrowsmi</dc:creator>
      <dc:date>2018-06-15T19:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: parsing  mgmt_cli using JQ delivers not expected result</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31577#M1901</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Interesting, I've tested the same syntax as you have provided and it is working just fine for me. If you forgo the pipe to jq does the command return a json response?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;[Expert@Hatter-2200:0]# mgmt_cli show service-tcp -s id.txt name http --format json | jq '{name: .name, port: .port}'&lt;BR /&gt;{&lt;BR /&gt; "name": "http",&lt;BR /&gt; "port": "80"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Jun 2018 21:47:03 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31577#M1901</guid>
      <dc:creator>Joshua_Hatter</dc:creator>
      <dc:date>2018-06-16T21:47:03Z</dc:date>
    </item>
    <item>
      <title>Re: parsing  mgmt_cli using JQ delivers not expected result</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31578#M1902</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It can be in case the show-service-tcp command fails (object not found, session expired, etc.)&lt;/P&gt;&lt;P&gt;For example here is the reproduction of the issue because of expired session:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.checkpoint.com/legacyfs/online/checkpoint/66432_jq-parse-after-logout.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Jun 2018 06:03:18 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31578#M1902</guid>
      <dc:creator>Eugene_Grybinny</dc:creator>
      <dc:date>2018-06-17T06:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: parsing  mgmt_cli using JQ delivers not expected result</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31579#M1903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not just use&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;mgmt_cli -r true&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;? &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.checkpoint.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When running on SMS and using - r(oot), no need to take care about expired session.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2018 04:55:40 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31579#M1903</guid>
      <dc:creator>Vincent_Bacher</dc:creator>
      <dc:date>2018-06-18T04:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: parsing  mgmt_cli using JQ delivers not expected result</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31580#M1904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It depends of the needs.&amp;nbsp;For example calling a read command many times will be much slower with &lt;STRONG&gt;-r true&lt;/STRONG&gt; (because of overhead for login and logout on each call). It is also recommended to login with read only permissions when one is&amp;nbsp;interested only in reads (it's impossible to achieve when using -r true for an actual command).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.checkpoint.com/legacyfs/online/checkpoint/66472_login-as-root-overhead.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2018 06:26:44 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31580#M1904</guid>
      <dc:creator>Eugene_Grybinny</dc:creator>
      <dc:date>2018-06-18T06:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: parsing  mgmt_cli using JQ delivers not expected result</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31581#M1905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good to know, thanks for that hint.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jun 2018 06:51:48 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/parsing-mgmt-cli-using-JQ-delivers-not-expected-result/m-p/31581#M1905</guid>
      <dc:creator>Vincent_Bacher</dc:creator>
      <dc:date>2018-06-18T06:51:48Z</dc:date>
    </item>
  </channel>
</rss>

