<?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: API issue - multi word string &amp; reserved word string in parametr value in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-issue-multi-word-string-reserved-word-string-in-parametr/m-p/10700#M836</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Pavel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Which API version are you using for the command execution? Related to the R80.10 GAiA it should be version 1.1 (but maybe you force 1.0 during the execution point?)&lt;/P&gt;&lt;P&gt;&amp;gt; Did you try to run the specified commands without the -s parameter (just for test purposes, you will be prompted to enter your credentials) as I am not sure if the point in ".sid" could be a problem (I currently can't test this).&lt;/P&gt;&lt;P&gt;&amp;gt; "&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Unrecognized parameter" should only be seen if the quotation was not done correctly, maybe you can show us screenshots of the entered commands + errors?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Maik&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Mar 2019 13:45:32 GMT</pubDate>
    <dc:creator>Maik</dc:creator>
    <dc:date>2019-03-06T13:45:32Z</dc:date>
    <item>
      <title>API issue - multi word string &amp; reserved word string in parametr value</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-issue-multi-word-string-reserved-word-string-in-parametr/m-p/10699#M835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Recently I was tasked to import several thousands of objects, policy and nat rules from R77 xml export files to R80.10 in just couple of days. I wrote a python scripts to generate the api commands but I came over a problem with strings for several parameters value. I had 2 major issues in general.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1) multi word strings&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;an example:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input:&lt;/STRONG&gt; mgmt_cli set host name "h-1.2.3.4" comments "Media-Server 2 London" -s .sid&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;response:&lt;/STRONG&gt; Error: The parameters of set-host command should be provided in pairs (key and value). You have provided an odd number of parameters which suggests that you are probably missing a parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;another typical example:&lt;/P&gt;&lt;P&gt;add access-section layer "pol-fw-backend-migrated Network" position bottom name "Stealth rule"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2) reserved word strings&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;an example:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input:&lt;/STRONG&gt; mgmt_cli set host name "h-1.2.3.4" comments "RSA server real IP" -s .sid&lt;BR /&gt;&lt;STRONG&gt;output:&lt;/STRONG&gt; code: "generic_err_invalid_parameter_name"&lt;BR /&gt;message: "Unrecognized parameter [RSA]"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both issues affects names, layers , sections, comments and maybe some other things.&lt;/P&gt;&lt;P&gt;I was really surprised that simple parameter string is evaluated as a parameter even when properly quoted and the source of the problem was not immediately clear in all cases especially when adding complex rules.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is if this is bug or sort of intended behavior or if it's possible to fix it or go around e.g. with some special quotes? I was able to use a workaround (UID instead of name for existing objects and merging multi word strings in python with underscore) but it required additional effort and time and also comments in objects and rules does not look so nice with all words separated by underscores &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;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2019 11:29:46 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-issue-multi-word-string-reserved-word-string-in-parametr/m-p/10699#M835</guid>
      <dc:creator>Pavel_Smejkal</dc:creator>
      <dc:date>2019-03-06T11:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: API issue - multi word string &amp; reserved word string in parametr value</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-issue-multi-word-string-reserved-word-string-in-parametr/m-p/10700#M836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Pavel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Which API version are you using for the command execution? Related to the R80.10 GAiA it should be version 1.1 (but maybe you force 1.0 during the execution point?)&lt;/P&gt;&lt;P&gt;&amp;gt; Did you try to run the specified commands without the -s parameter (just for test purposes, you will be prompted to enter your credentials) as I am not sure if the point in ".sid" could be a problem (I currently can't test this).&lt;/P&gt;&lt;P&gt;&amp;gt; "&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Unrecognized parameter" should only be seen if the quotation was not done correctly, maybe you can show us screenshots of the entered commands + errors?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Maik&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2019 13:45:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-issue-multi-word-string-reserved-word-string-in-parametr/m-p/10700#M836</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2019-03-06T13:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: API issue - multi word string &amp; reserved word string in parametr value</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/API-issue-multi-word-string-reserved-word-string-in-parametr/m-p/10701#M837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well OK, Layer 8 issue &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; (between the keyboard and a chair). I took a second look at the problem and it has nothing to do with the API. I used a python script to generate sets of commands which I pushed via bash script and I forgot to eval the commands with string parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if [ -z "$1" ]&lt;BR /&gt;then&lt;BR /&gt;&amp;nbsp; echo "Usage: `basename $0` [batch]"&lt;BR /&gt;&amp;nbsp; exit&lt;BR /&gt;fi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mgmt_cli login user admin password secret &amp;gt; .sid&lt;/P&gt;&lt;P&gt;batch=$1&lt;BR /&gt;while IFS= read -r line; do&lt;BR /&gt;&amp;nbsp; printf '%s&amp;nbsp; -s .sid \n' "$line"&lt;BR /&gt;&amp;nbsp; eval $line -s .sid&lt;BR /&gt;done &amp;lt; $batch&lt;/P&gt;&lt;P&gt;mgmt_cli publish -s .sid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2019 09:49:13 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/API-issue-multi-word-string-reserved-word-string-in-parametr/m-p/10701#M837</guid>
      <dc:creator>Pavel_Smejkal</dc:creator>
      <dc:date>2019-03-07T09:49:13Z</dc:date>
    </item>
  </channel>
</rss>

