<?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 Api Sessions in VMware{code} Discussions</title>
    <link>https://communities.vmware.com/t5/VMware-code-Discussions/Api-Sessions/m-p/2958873#M2248</link>
    <description>&lt;P&gt;Hello Folks,&lt;/P&gt;&lt;P&gt;I am getting to know the api for vmware(ViewAdmin 8, 2111) but unfortunately the &lt;A href="https://developer.vmware.com/samples/7598/manage-horizon-sessions-by-user" target="_self"&gt;solution&lt;/A&gt; provided to get this csv is with powercli. Unfortunately my environment does not have these modules and I am not able to install them. I have looked at the swagger ui section and do not see the endpoint for this. Here is the pictures where I show you the steps of what I like to accomplish from the api query.&lt;/P&gt;&lt;P&gt;1) On picture one I select the subcategory Sessions from Monitor&lt;/P&gt;&lt;P&gt;2) After the query is made there is a table that is created and you have the option of downloading a csv. That is displayed on two.png.&lt;/P&gt;&lt;P&gt;3) I have a little snippet you can view on three.png&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Mar 2023 13:35:09 GMT</pubDate>
    <dc:creator>cu3rv0x</dc:creator>
    <dc:date>2023-03-17T13:35:09Z</dc:date>
    <item>
      <title>Api Sessions</title>
      <link>https://communities.vmware.com/t5/VMware-code-Discussions/Api-Sessions/m-p/2958873#M2248</link>
      <description>&lt;P&gt;Hello Folks,&lt;/P&gt;&lt;P&gt;I am getting to know the api for vmware(ViewAdmin 8, 2111) but unfortunately the &lt;A href="https://developer.vmware.com/samples/7598/manage-horizon-sessions-by-user" target="_self"&gt;solution&lt;/A&gt; provided to get this csv is with powercli. Unfortunately my environment does not have these modules and I am not able to install them. I have looked at the swagger ui section and do not see the endpoint for this. Here is the pictures where I show you the steps of what I like to accomplish from the api query.&lt;/P&gt;&lt;P&gt;1) On picture one I select the subcategory Sessions from Monitor&lt;/P&gt;&lt;P&gt;2) After the query is made there is a table that is created and you have the option of downloading a csv. That is displayed on two.png.&lt;/P&gt;&lt;P&gt;3) I have a little snippet you can view on three.png&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 13:35:09 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-code-Discussions/Api-Sessions/m-p/2958873#M2248</guid>
      <dc:creator>cu3rv0x</dc:creator>
      <dc:date>2023-03-17T13:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Api Sessions</title>
      <link>https://communities.vmware.com/t5/VMware-code-Discussions/Api-Sessions/m-p/2959646#M2250</link>
      <description>&lt;P&gt;Use vSphere SOAP-based (vSphere Management SDK) APIs to get the API sessions.&lt;/P&gt;&lt;P&gt;API:&amp;nbsp;&lt;A title="SessionManager" href="https://vdc-repo.vmware.com/vmwb-repository/dcr-public/723e7f8b-4f21-448b-a830-5f22fd931b01/5a8257bd-7f41-4423-9a73-03307535bd42/doc/vim.SessionManager.html#field_detail" target="_self"&gt;SessionManager&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;sessionList&lt;/STRONG&gt;&lt;SPAN class=""&gt;*&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;A href="https://vdc-repo.vmware.com/vmwb-repository/dcr-public/723e7f8b-4f21-448b-a830-5f22fd931b01/5a8257bd-7f41-4423-9a73-03307535bd42/doc/vim.UserSession.html" target="_blank" rel="noopener"&gt;UserSession[]&lt;/A&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;&lt;SPAN&gt;The list of currently active sessions.&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To get your API sessions, compare the client machine's IP address and application name with the IpAddress and UserAgent of the &lt;A title="UserSession" href="https://vdc-repo.vmware.com/vmwb-repository/dcr-public/723e7f8b-4f21-448b-a830-5f22fd931b01/5a8257bd-7f41-4423-9a73-03307535bd42/doc/vim.UserSession.html" target="_self"&gt;UserSession&lt;/A&gt;&amp;nbsp;object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;	public void printUserSessions(String vCenterServer, String userName, String password) {
		try {
			si = new ServiceInstance(new URL("https://" + vCenterServer + "/sdk"), userName, password, false);
			SessionManager sm = si.getSessionManager();
			UserSession[] usList = sm.getSessionList();
			for (UserSession us : usList) {
				System.out.println("Client IPAddress::" + us.getIpAddress());
				System.out.println("Session Username::" + us.getUserName());
				System.out.println("Application/UserAgent::" + us.getUserAgent());
				System.out.println("--------------------------------------------------");
			}
		} catch (Exception e) {
			System.err.println("Error ServiceInstance::" + e.getLocalizedMessage());
		}
	}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Mar 2023 05:47:23 GMT</pubDate>
      <guid>https://communities.vmware.com/t5/VMware-code-Discussions/Api-Sessions/m-p/2959646#M2250</guid>
      <dc:creator>doskiran</dc:creator>
      <dc:date>2023-03-17T05:47:23Z</dc:date>
    </item>
  </channel>
</rss>

