Get cluster user sessions

  • Published Apr 02, 2020

This API call gets users sessions based on a specific user ID. You can request a list of user sessions for a specific user ID in a specific environment.

Authentication

To execute this request, you need the Service Provider API (ServiceProviderAPI) permission assigned to your API token. Generate your API token via Cluster Management Console (CMC). To learn how to obtain and use it, see Cluster API - Authentication.

Endpoint

/api/cluster/v2/userSessions

Parameters

ParameterTypeDescriptionInRequired
userIdstring

User ID (optional)

queryoptional

Response

Response codes

CodeTypeDescription
200UserSession[]

Success

500-

Operation failed

Response body objects

The ResponseBody object

The UserSession object

Managed user session instance

ElementTypeDescription
userIdstring

User id

nodeIdinteger

Node on which user session exists

sessionIdstring

User session id

creationTimeinteger

User session creation timestamp

lastAccessedTimestampinteger

Timestamp when session was recently accessed

tenantUuidstring

UUID of tenant to which user has logged in (or cluster UUID if user has logged in to CMC)

loginTypestring

The way user has logged in

  • LOCAL
  • LDAP
  • SSO_MANAGED
  • DEVOPSTOKEN
devicestring

Device on which user has logged in

ipstring

IP from which has logged in

Response body JSON model

[
{
"userId": "string",
"nodeId": 1,
"sessionId": "string",
"creationTime": 1,
"lastAccessedTimestamp": 1,
"tenantUuid": "string",
"loginType": "LOCAL",
"device": "string",
"ip": "string"
}
]

Example

In this example, the request lists user sessions in the myManaged.cluster.com cluster for user user.name.

Curl

curl -X GET "https://myManaged.cluster.com/api/cluster/v2/userSessions?userId=user.name"
-H "accept: application/json"

Request URL

https://myManaged.cluster.com/api/cluster/v2/userSessions?userId=user.name

Response body

[
{
"userId": "user.name",
"nodeId": 4,
"sessionId": "string",
"creationTime": 0,
"lastAccessedTimestamp": 0,
"tenantUuid": "string",
"loginType": "LOCAL",
"device": "string",
"ip": "string"
}
]

Response code

200