<?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 Powershell API Login Not Returning UID in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124626#M6051</link>
    <description>&lt;P&gt;I've done at least a dozen API implementation in Powershell. The instructions are standard.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html?#web/login~v1.5%20" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/index.html?#web/login~v1.5%20&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;When I run the login, the uid does not get returned.&lt;BR /&gt;&lt;BR /&gt;$header = @{"content-Type"="application/json"}&lt;BR /&gt;$body =&lt;BR /&gt;"&lt;BR /&gt;{&lt;BR /&gt;""user"":""me"",&lt;BR /&gt;""password"":""mypassword""&lt;BR /&gt;}&lt;BR /&gt;"&lt;/P&gt;&lt;P&gt;$uri = "&lt;A href="https://mymanager.here.com/web_api/login" target="_blank"&gt;https://mymanager.here.com/web_api/login&lt;/A&gt;"&lt;BR /&gt;$result = Invoke-WebRequest -uri $uri -headers $header -Body $body -method post&lt;BR /&gt;&lt;BR /&gt;$result.RawContent&lt;/P&gt;&lt;P&gt;HTTP/1.1 200 OK&lt;BR /&gt;Strict-Transport-Security: max-age=31536000; includeSubDomains&lt;BR /&gt;X-Frame-Options: SAMEORIGIN&lt;BR /&gt;X-UA-Compatible: IE=EmulateIE8&lt;BR /&gt;X-Forwarded-Host-Port: 443&lt;BR /&gt;Transfer-Encoding: chunked&lt;BR /&gt;Content-Type: application/json&lt;BR /&gt;Date: Wed, 21 Jul 2021 23:30:11 GMT&lt;BR /&gt;Server: CPWS&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"sid" : "TwYUh3EiZAbjK6D1gDB-3461a7HzYmDUVY0cT06susw",&lt;BR /&gt;"url" : "&lt;A href="https://mymanager.here.com:443/web_api/v1.5" target="_blank"&gt;https://mymanager.here.com:443/web_api/v1.5&lt;/A&gt;",&lt;BR /&gt;"session-timeout" : 600,&lt;BR /&gt;"last-login-was-at" : {&lt;BR /&gt;"posix" : 1626910193164,&lt;BR /&gt;"iso-8601" : "2021-07-21T16:29-0700"&lt;BR /&gt;},&lt;BR /&gt;"read-only" : true,&lt;BR /&gt;"api-server-version" : "1.5"&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jul 2021 00:06:53 GMT</pubDate>
    <dc:creator>davidjblackburn</dc:creator>
    <dc:date>2021-07-22T00:06:53Z</dc:date>
    <item>
      <title>Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124626#M6051</link>
      <description>&lt;P&gt;I've done at least a dozen API implementation in Powershell. The instructions are standard.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html?#web/login~v1.5%20" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/index.html?#web/login~v1.5%20&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;When I run the login, the uid does not get returned.&lt;BR /&gt;&lt;BR /&gt;$header = @{"content-Type"="application/json"}&lt;BR /&gt;$body =&lt;BR /&gt;"&lt;BR /&gt;{&lt;BR /&gt;""user"":""me"",&lt;BR /&gt;""password"":""mypassword""&lt;BR /&gt;}&lt;BR /&gt;"&lt;/P&gt;&lt;P&gt;$uri = "&lt;A href="https://mymanager.here.com/web_api/login" target="_blank"&gt;https://mymanager.here.com/web_api/login&lt;/A&gt;"&lt;BR /&gt;$result = Invoke-WebRequest -uri $uri -headers $header -Body $body -method post&lt;BR /&gt;&lt;BR /&gt;$result.RawContent&lt;/P&gt;&lt;P&gt;HTTP/1.1 200 OK&lt;BR /&gt;Strict-Transport-Security: max-age=31536000; includeSubDomains&lt;BR /&gt;X-Frame-Options: SAMEORIGIN&lt;BR /&gt;X-UA-Compatible: IE=EmulateIE8&lt;BR /&gt;X-Forwarded-Host-Port: 443&lt;BR /&gt;Transfer-Encoding: chunked&lt;BR /&gt;Content-Type: application/json&lt;BR /&gt;Date: Wed, 21 Jul 2021 23:30:11 GMT&lt;BR /&gt;Server: CPWS&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"sid" : "TwYUh3EiZAbjK6D1gDB-3461a7HzYmDUVY0cT06susw",&lt;BR /&gt;"url" : "&lt;A href="https://mymanager.here.com:443/web_api/v1.5" target="_blank"&gt;https://mymanager.here.com:443/web_api/v1.5&lt;/A&gt;",&lt;BR /&gt;"session-timeout" : 600,&lt;BR /&gt;"last-login-was-at" : {&lt;BR /&gt;"posix" : 1626910193164,&lt;BR /&gt;"iso-8601" : "2021-07-21T16:29-0700"&lt;BR /&gt;},&lt;BR /&gt;"read-only" : true,&lt;BR /&gt;"api-server-version" : "1.5"&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 00:06:53 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124626#M6051</guid>
      <dc:creator>davidjblackburn</dc:creator>
      <dc:date>2021-07-22T00:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124636#M6052</link>
      <description>&lt;P&gt;Sounds like a bug worthy of a TAC case, which I'm guessing was fixed at some point since R81.10 appears to return the uid.&lt;BR /&gt;Also tagging&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/37502"&gt;@Omer_Kleinstern&lt;/a&gt;.&lt;/P&gt;
&lt;P&gt;Note that what's really important at least as far as calling the API is the sid.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 03:59:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124636#M6052</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-07-22T03:59:31Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124693#M6054</link>
      <description>&lt;P&gt;Thanks PhoneBoy! We haven't run across each other since 1998. I hope you've been doing ok!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 14:24:12 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124693#M6054</guid>
      <dc:creator>davidjblackburn</dc:creator>
      <dc:date>2021-07-22T14:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124702#M6055</link>
      <description>&lt;P&gt;Still at it 20+ years later. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 15:44:37 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124702#M6055</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-07-22T15:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124710#M6056</link>
      <description>&lt;P&gt;You're in read-only mode. Note the "read-only" : true at the bottom. Read-only sessions don't get a UUID, just a SID.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 18:13:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124710#M6056</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2021-07-22T18:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124711#M6057</link>
      <description>&lt;P&gt;Well, rats. I suspected as much.&lt;BR /&gt;I'm an infosec guy and don't want much more access to the manager. But, I do like checking stuff often, like the threat protection.&lt;BR /&gt;Is there a document that lists the minimum access for the API functions?&lt;/P&gt;&lt;P&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/index.html?#web/show-threat-protection~v1.5%20" target="_blank"&gt;https://sc1.checkpoint.com/documents/latest/APIs/index.html?#web/show-threat-protection~v1.5%20&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 18:19:11 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124711#M6057</guid>
      <dc:creator>davidjblackburn</dc:creator>
      <dc:date>2021-07-22T18:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124721#M6059</link>
      <description>&lt;P&gt;That kinda makes sense, but it&amp;nbsp;does point to an issue with the API documentation.&lt;BR /&gt;We should probably note that a UID won't be returned for a read-only session.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 22:18:09 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124721#M6059</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-07-22T22:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124722#M6060</link>
      <description>&lt;P&gt;There is only one permission specific to the API: namely you can use it or not.&lt;BR /&gt;All other permissions are granted using the standard permission profile for your user.&lt;BR /&gt;I presume that particular API call is allowed based on whether your profile gives you access to Threat Prevention &amp;gt; Permissions &amp;gt; Protections or not.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 22:27:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124722#M6060</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2021-07-22T22:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124724#M6062</link>
      <description>&lt;P&gt;I mean, the only thing the UUID does is give you the ability to publish or discard the session. Can’t publish or discard a read-only session.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 22:37:28 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/124724#M6062</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2021-07-22T22:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell API Login Not Returning UID</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/204346#M8314</link>
      <description>&lt;P&gt;While building an R81.20 MDS in my lab, I noticed read-only sessions get a UUID now:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;➜  ~ curl -k https://standaloneR8110/web_api/login --header "Content-Type: application/json" -d '{"user":"admin","password":"1qaz!QAZ","read-only":true}'
{
  "sid" : "Xqq38zvtE1plx4ni6Ut5y22KXPLQYQoanE8_sP1m-w8",
  "url" : "https://standaloneR8110:443/web_api",
  "session-timeout" : 600,
  "last-login-was-at" : {...},
  "read-only" : true,
  "api-server-version" : "1.8.1",
  "user-name" : "admin",
  "user-uid" : "f15f2c0c-ca41-4d4f-ab1c-9c853e767005"
}

➜  ~ curl -k https://mdsR8120/web_api/login --header "Content-Type: application/json" -d '{"user":"admin","password":"1qaz!QAZ","read-only":true}'
{
  "uid" : "00e564c5-a40c-41e7-9f07-cb2e2da33cc9",
  "sid" : "SfhKiZMZE8rwZ5KeIuysfqiqzliqMo7F5D3g1OUlVyI",
  "url" : "https://mdsR8120:443/web_api",
  "session-timeout" : 600,
  "read-only" : true,
  "api-server-version" : "1.9",
  "user-name" : "admin",
  "user-uid" : "80617f9d-db66-4c0b-815d-4799d12eb3fd"
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;R81.20 SmartCenters also return a UUID. The missing "last-login-was-at" in the MDS output is because this was a new VM and I hadn't logged in before.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jan 2024 23:11:42 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/Powershell-API-Login-Not-Returning-UID/m-p/204346#M8314</guid>
      <dc:creator>Bob_Zimmerman</dc:creator>
      <dc:date>2024-01-27T23:11:42Z</dc:date>
    </item>
  </channel>
</rss>

