<?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: get VPN users email address in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/76761#M4490</link>
    <description>&lt;P&gt;There are no official APIs for users.&lt;BR /&gt;Which means we're stuck using the generic-object API.&lt;BR /&gt;The following one-liner should get you what you need in CSV format:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;SID=`mgmt_cli -r true login --format json | jq '.sid' -r`; mgmt_cli --session-id $SID show generic-objects class-name "com.checkpoint.objects.classes.dummy.CpmiUser" --format json | jq '.objects[].uid' | while read X; do mgmt_cli --session-id $SID show generic-object uid $X --format json | jq '[.cpmiName, .email] | @csv' -r; done; mgmt_cli --session-id $SID logout &amp;gt; /dev/null&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This creates a session (using -r true), gets all the users (up to 500 I think) and queries each use record (by uid) to get the name and email address, then logs the session out.&lt;BR /&gt;Output is in CSV format.&lt;/P&gt;</description>
    <pubDate>Mon, 02 Mar 2020 01:57:58 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2020-03-02T01:57:58Z</dc:date>
    <item>
      <title>get VPN users email address</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/76615#M4489</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I need to write an email to all our CheckPoint (R80.20) VPN user (which are about 200) and for that I need a list with just name and email address (without getting it manually from SmartConsole &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;).&lt;/P&gt;&lt;P&gt;Is there a short command from maybe mgmt_cli or dbedit to get this list?&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Thu, 27 Feb 2020 16:38:36 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/76615#M4489</guid>
      <dc:creator>Peter-MIS</dc:creator>
      <dc:date>2020-02-27T16:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: get VPN users email address</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/76761#M4490</link>
      <description>&lt;P&gt;There are no official APIs for users.&lt;BR /&gt;Which means we're stuck using the generic-object API.&lt;BR /&gt;The following one-liner should get you what you need in CSV format:&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;SID=`mgmt_cli -r true login --format json | jq '.sid' -r`; mgmt_cli --session-id $SID show generic-objects class-name "com.checkpoint.objects.classes.dummy.CpmiUser" --format json | jq '.objects[].uid' | while read X; do mgmt_cli --session-id $SID show generic-object uid $X --format json | jq '[.cpmiName, .email] | @csv' -r; done; mgmt_cli --session-id $SID logout &amp;gt; /dev/null&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This creates a session (using -r true), gets all the users (up to 500 I think) and queries each use record (by uid) to get the name and email address, then logs the session out.&lt;BR /&gt;Output is in CSV format.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 01:57:58 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/76761#M4490</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-03-02T01:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: get VPN users email address</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/76986#M4498</link>
      <description>&lt;P&gt;Hello Phone-Boy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for your fast response!&lt;/P&gt;&lt;P&gt;Your Oneliner is working, but only for the first 50 (not 500) entries...&lt;/P&gt;&lt;P&gt;How can I change it to get all of my users?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and best regards,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 13:01:51 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/76986#M4498</guid>
      <dc:creator>Peter-MIS</dc:creator>
      <dc:date>2020-03-03T13:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: get VPN users email address</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/77008#M4504</link>
      <description>It just means you need to call the API multiple times.&lt;BR /&gt;The above part of the command would need to be modified to get the next 50 users as follows: &lt;BR /&gt;&lt;BR /&gt;mgmt_cli --session-id $SID show generic-objects class-name "com.checkpoint.objects.classes.dummy.CpmiUser" limit 50 offset 50 --format json&lt;BR /&gt;&lt;BR /&gt;Then change it to "offset 100" to get the next 50, etc.&lt;BR /&gt;I'm sure this could be scripted easily enough parsing the initial output of the API.</description>
      <pubDate>Tue, 03 Mar 2020 16:17:24 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/77008#M4504</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-03-03T16:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: get VPN users email address</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/77149#M4520</link>
      <description>&lt;P&gt;max is 500, so it will cover all your 200 users in one go.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 16:35:24 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/77149#M4520</guid>
      <dc:creator>abihsot__</dc:creator>
      <dc:date>2020-03-04T16:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: get VPN users email address</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/77167#M4523</link>
      <description>&lt;P&gt;Hi abihsot_&lt;/P&gt;&lt;P&gt;maybe it should, but it didn't work for me: I only got 50...&lt;/P&gt;&lt;P&gt;But with the suggestion from PhoneBoy&amp;nbsp;"limit 50 offset 50&amp;nbsp;" and calling it 4 times (with different offset) everything is working fine for me.&lt;/P&gt;&lt;P&gt;Thanks all a lot for your help!&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 17:31:17 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/77167#M4523</guid>
      <dc:creator>Peter-MIS</dc:creator>
      <dc:date>2020-03-04T17:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: get VPN users email address</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/77200#M4526</link>
      <description>Some API calls have different limits to them.&lt;BR /&gt;I assumed (incorrectly) it was 500 in this case.</description>
      <pubDate>Wed, 04 Mar 2020 23:58:04 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/get-VPN-users-email-address/m-p/77200#M4526</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-03-04T23:58:04Z</dc:date>
    </item>
  </channel>
</rss>

