Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

The /v2/session resource provides a list of valid vCenter sessions of the user making the request.

ResourceURIDescriptionGETPOSTPUTDELETE
Session/sessionCurrent user vCenter active sessions(tick)
(tick)(tick)(tick)

 

 







Panel

On this page:

Table of Contents
outlinetrue



http OPTIONS "

TK stores the Cloud API Token generated as a result of the following POST request to the /auth/request-token resource:

Note
titleOPTIONS HTTP method

Remember, you can also show what methods are allowed and method description, parameters, etc. by making a GET HTTP request to /v2/session.

Code Block
languagebash
Code Block
curl -X POST https://vss-api.eis.utoronto.ca:8001/v2/session"
auth/request-token -u <username>

For example, extracting the token with the jq command:

Code Block
TK=$(curl -X OPTIONSPOST "https://vss-api.eis.utoronto.ca:8001/v2/session"auth/request-token -u <username> | jq -r '.token')


List

Enumerating current user valid vCenter sessions can be done by making a GET request to /v2/session resource, which in case the user actually has at least one valid session, a list of JSON objects with the following attributes will be the result:

AttributeTypeDescription
keystringvCenter session key
usernamestringFull username including domain associated with session
_linksobjectContains reference to current session to display further information

The following examples implements HTTPie and CURL to list valid vCenter sessions:

Code Block
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/session" "Authorization: Bearer $TK"
curl -uH "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca:8001/v2/session"


Code Block
languagepy
titleResponse Body
collapsetrue
{
    "_links": {
        "api": "https://vss-api.eis.utoronto.ca:8001/v2/",
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/session"
    },
    "data": [
        {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/session/521615fc-1b09-bee9-0350-2a79568f4ad0"
            },
            "key": "521615fc-1b09-bee9-0350-2a79568f4ad0",
            "username": "VSKEY5\\josem"
        }
    ],
    "meta": {
        "count": 1,
        "time": "0.00801s",
        "user": "josem"
    }
}

Getting additional information about specific session can be done appending the session key to the /v2/session URI as follows:

Code Block
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/session/521615fc-1b09-bee9-0350-2a79568f4ad0" "Authorization: Bearer $TK"
curl -uH "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca:8001/v2/session/521615fc-1b09-bee9-0350-2a79568f4ad0"

Additional attributes will be shown as a result and are described in the following table:

AttributeTypeDescription
domainstringAuthentication domain (usually VSKEY).
ipstringIP address of remote client.
lastActiveTimestringTimestamp of last active time
lastActiveTimeDeltastringTime delta of last active time to now.
loginTimestringTimestamp when login.
loginTimeDeltastringTime delta of login time to now.
userAgentstring

What application is connected to vCenter.

  • VMware VI Client - vSphere Windows Client


Code Block
languagepy
titleResponse Body
collapsetrue
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/session/521615fc-1b09-bee9-0350-2a79568f4ad0",
        "session": "https://vss-api.eis.utoronto.ca:8001/v2/session"
    },
    "data": [
        {
            "domain": "VSKEY5",
            "ip": "12810.1000.1020.2221",
            "lastActiveTime": "2016-05-09 10:58:21",
            "lastActiveTimeDelta": "0:13:59.079416",
            "loginTime": "2016-04-15 11:11:28",
            "loginTimeDelta": "24 days, 0:00:51.439527",
            "userAgent": "VMware VI Client/4.0",
            "username": "VSKEY5\\josem"
        }
    ],
    "meta": {
        "count": 1,
        "time": "0.03858s",
        "user": "josem"
    }
}