Viewing and closing web sessions

Overview

Displays open web sessions and allows forcibly closing them with various requests.

Requests

HTTP verb Endpoint Description

GET

/rest/v1/master/logicalroles/ws/sessions

Getting the list of open web sessions.

POST

/rest/v1/master/logicalroles/ws/sessions

Closing all user web sessions in the domain

DELETE

/rest/v1/master/logicalroles/ws/sessions/<session_id>

Closing one web session

Common request parameters

The parameters below are passed in the URL query string part (?param=value) for GET and DELETE requests, and for POST — in the request body. The parameters are used to limit the request application area. They are optional and may be absent.

Table 1. Possible parameters
Name Type Description

sites

json<str> or json<list<str>>

List of site names or a string with one of the special values in JSON format.

For example ["SITE1","SITE3"] or "all" (all sites) or "current" (current site, default value).


Getting the list of open web sessions.

Returns the list of open web sessions on the current site or on the site(s) specified in the request.

Request

There are no additional parameters. Only the common site filter applies.

Example request
GET /rest/v1/master/master/logicalroles/ws/sessions?sites=["SITE1"] HTTP/1.1

Response

Contains the list of open web sessions.

Table 2. Object fields
Name Description

connections

Active websocket connections (only for sessions where session_type = webdocket).

domain

Web session domain.

login

Web session user login in the domain.

session_id

Web session identifier.

session_type

Web session type.

site

Web session site.

ttl

Remaining web session lifetime in seconds.

user_id

Web session user identifier in the domain.

Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

[
  {
    "domain": "master.domain",
    "login": "curl",
    "session_id": "a1cd9a88-0176-9a15-d1c0-e0d55e0cd303",
    "session_type": "http",
    "site": "central",
    "ttl": 43187,
    "user_id": "32328e08-016c-f61d-4ef4-e0d55e0cd303"
  },
  {
    "domain": "master.domain",
    "login": "adminma",
    "session_id": "0f274f6b-0176-99e4-5ca7-e0d55e0cd303",
    "session_type": "http",
    "site": "central",
    "ttl": 39946,
    "user_id": "37eca732-016d-2962-dbfa-e0d55e0cd303"
  },
  {
    "domain": "master.domain",
    "login": "adminma",
    "session_id": "16d72c4c-0176-99e7-5545-e0d55e0cd303",
    "session_type": "http",
    "site": "central",
    "ttl": 40141,
    "user_id": "37eca732-016d-2962-dbfa-e0d55e0cd303"
  },
  {
    "connections": [
      {
        "conn_id": "5476d54a-0176-9a16-92a0-e0d55e0cd303",
        "is_pid_alive": true,
        "node": "ws1@192.168.0.32",
        "pid": "<0.11647.54>"
      }
    ],
    "domain": "master.domain",
    "login": "adminma",
    "session_id": "16d72c4c-0176-99e7-5545-e0d55e0cd303",
    "session_type": "websocket",
    "site": "central",
    "ttl": 40141,
    "user_id": "37eca732-016d-2962-dbfa-e0d55e0cd303"
  }
]

Closing all user web sessions in the domain

Closes all user web sessions in the domain except the session used in the request.

Request

The request may contain additional scope parameters.

Table 3. Object fields
Name Type Description

action

str

Action. The field must contain the value "logout".

domain

str

Domain for closing sessions.

user

str

User for closing sessions. Either id or login of the user entity is accepted.

Example request
POST /rest/v1/master/logicalroles/ws/sessions HTTP/1.1
Content-Type: application/json; charset=utf-8

{
  "action": "logout",
  "domain": "master.domain",
  "user": "admin",
  "sites": "all"
}

Response

Contains the request execution status.

Table 4. Object fields
Name Description

status

Text "logged out all sessions but current".

Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
  "status": "logged out all sessions but current"
}

Closing one web session

Closes the web session with the specified identifier.

Request

The request may contain additional scope parameters.

Example request
DELETE /rest/v1/master/logicalroles/ws/sessions/51e6cad2-0176-8f8e-a432-e0d55e0cd303?sites="all" HTTP/1.1

Response

Example response
HTTP/1.1 204 No Content