<?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 vRO REST call to SMS failing in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/vRO-REST-call-to-SMS-failing/m-p/27718#M1608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am attempting to add a host to an SMS using REST calls from VMware vRO. All REST calls work correctly using Postman, but fail with vRO. I created a workflow in vRO that will login into the SMS using REST which responds with the "SID" along with other output. I then "JSON.parse" the output and create a JSON object using the SID. A system.log clearly displays the SID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The workflow continues to the next workflow which should add a host to an existing object-group on SMS. The REST call is the standard vRO script however, I added the following to "add a host":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var addHost = "/add-host";&lt;BR /&gt;var requestUrl = baseUrl + addHost;&lt;BR /&gt;var HostContent = { "name" : "jawa", "ip-address" : "192.168.2.2", "groups" : "Shun List" }&lt;BR /&gt;System.log("Request full URL: " + requestUrl);&lt;BR /&gt;System.log("sid: " + sid);&lt;BR /&gt;var request = transientHost.createRequest(httpMethod, addHost, HostContent);&lt;BR /&gt;request.contentType = contentType;&lt;BR /&gt;&lt;STRONG&gt;request.setHeader("X-chkp-sid: ", sid)&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the workflow runs, I get the SID just fine, parse it to JSON, and attach it to the "X-chkp-sid" header however, it fails:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2019-01-24 12:51:49.359] [I] Request full URL: https://192.168.89.151/web_api/add-host&lt;BR /&gt;[2019-01-24 12:51:49.360] [I] sid: kbTPfF3mzURhaYWGCs7FGgr5jjQy0PtWA7kMvfMxUlw&lt;BR /&gt;[2019-01-24 12:51:49.364] [I] Executing REST request with dynamic credentials: vROadmin&lt;BR /&gt;[2019-01-24 12:51:49.365] [I] Query string: /add-host&lt;BR /&gt;[2019-01-24 12:51:49.367] [I] Base URL: https://192.168.89.151/web_api&lt;BR /&gt;[2019-01-24 12:51:49.487] [I] Content as string: {&lt;BR /&gt; &lt;STRONG&gt;"code" : "generic_err_wrong_session_id",&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; "message" : "Wrong session id [\"kbTPfF3mzURhaYWGCs7FGgr5jjQy0PtWA7kMvfMxUlw\"]. Session may be expired. Please check session id and resend the request."&lt;/STRONG&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SID is not wrong though. It matches what the /login workflow returned just milliseconds prior. Also, the session on the SMS is still open...vRO did not close it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Jan 2019 21:06:34 GMT</pubDate>
    <dc:creator>Darek_Dowsett</dc:creator>
    <dc:date>2019-01-25T21:06:34Z</dc:date>
    <item>
      <title>vRO REST call to SMS failing</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/vRO-REST-call-to-SMS-failing/m-p/27718#M1608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am attempting to add a host to an SMS using REST calls from VMware vRO. All REST calls work correctly using Postman, but fail with vRO. I created a workflow in vRO that will login into the SMS using REST which responds with the "SID" along with other output. I then "JSON.parse" the output and create a JSON object using the SID. A system.log clearly displays the SID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The workflow continues to the next workflow which should add a host to an existing object-group on SMS. The REST call is the standard vRO script however, I added the following to "add a host":&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var addHost = "/add-host";&lt;BR /&gt;var requestUrl = baseUrl + addHost;&lt;BR /&gt;var HostContent = { "name" : "jawa", "ip-address" : "192.168.2.2", "groups" : "Shun List" }&lt;BR /&gt;System.log("Request full URL: " + requestUrl);&lt;BR /&gt;System.log("sid: " + sid);&lt;BR /&gt;var request = transientHost.createRequest(httpMethod, addHost, HostContent);&lt;BR /&gt;request.contentType = contentType;&lt;BR /&gt;&lt;STRONG&gt;request.setHeader("X-chkp-sid: ", sid)&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the workflow runs, I get the SID just fine, parse it to JSON, and attach it to the "X-chkp-sid" header however, it fails:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2019-01-24 12:51:49.359] [I] Request full URL: https://192.168.89.151/web_api/add-host&lt;BR /&gt;[2019-01-24 12:51:49.360] [I] sid: kbTPfF3mzURhaYWGCs7FGgr5jjQy0PtWA7kMvfMxUlw&lt;BR /&gt;[2019-01-24 12:51:49.364] [I] Executing REST request with dynamic credentials: vROadmin&lt;BR /&gt;[2019-01-24 12:51:49.365] [I] Query string: /add-host&lt;BR /&gt;[2019-01-24 12:51:49.367] [I] Base URL: https://192.168.89.151/web_api&lt;BR /&gt;[2019-01-24 12:51:49.487] [I] Content as string: {&lt;BR /&gt; &lt;STRONG&gt;"code" : "generic_err_wrong_session_id",&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; "message" : "Wrong session id [\"kbTPfF3mzURhaYWGCs7FGgr5jjQy0PtWA7kMvfMxUlw\"]. Session may be expired. Please check session id and resend the request."&lt;/STRONG&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The SID is not wrong though. It matches what the /login workflow returned just milliseconds prior. Also, the session on the SMS is still open...vRO did not close it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2019 21:06:34 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/vRO-REST-call-to-SMS-failing/m-p/27718#M1608</guid>
      <dc:creator>Darek_Dowsett</dc:creator>
      <dc:date>2019-01-25T21:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: vRO REST call to SMS failing</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/vRO-REST-call-to-SMS-failing/m-p/27719#M1609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From what the error message says, it looks like whatever is creating the X-chkp-sid header is adding quotes around the sid value.&lt;/P&gt;&lt;P&gt;When I manually do that (e.g. using curl), I get a similar error message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 26 Jan 2019 01:19:06 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/vRO-REST-call-to-SMS-failing/m-p/27719#M1609</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-01-26T01:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: vRO REST call to SMS failing</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/vRO-REST-call-to-SMS-failing/m-p/27720#M1610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to everyone. I was able to abstract a log on the Checkpoint that detailed the headers and I could see that my script was inserting both a colon and a space which were invalid to the Checkpoint device.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2019 16:12:39 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/vRO-REST-call-to-SMS-failing/m-p/27720#M1610</guid>
      <dc:creator>Darek_Dowsett</dc:creator>
      <dc:date>2019-01-29T16:12:39Z</dc:date>
    </item>
  </channel>
</rss>

