Show contents 

Web Service > Web Service Operations > Working with a Repository > GetSessions

GetSessions

Syntax

GetSessionsResult GetSessions(MbId tMbSec, GetSessionsArg tArg)

Parameters

tMbSec. Repository connection moniker.

tArg. Operation execution parameters.

Description

The GetSessions operation gets the list of active repository sessions.

Comments

To execute the operation, in the tMbSec field specify repository connection moniker. The moniker can be obtained on executing the OpenMetabase operation.

At the first execution of the GetSessions operation, use the tArg.credsCachePattern and tArg.credsCacheMeta fields to cache credentials of the user who has user administration permissions. The credentials will be used within the current session. One does not need to enter credentials on repeated calls of the GetSessions operation.

One can use the tArg.filters field to set various fields used for filtering of sessions. If it is not required to filter sessions, set the tArg field as empty.

The operation results in the obtained list of active repository sessions.

Example

Below is the example of getting the list of active repository sessions. The request contains repository connection moniker and required credentials. The response contains information about sessions.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<GetSessions xmlns="http://www.fsight.ru/PP.SOM.Som">
<tMbSec xmlns="">
  <id>DMBIHLCAPCGEGOAECEFNBPIJOCIPPDIELLELNHENINPKCHIO!M</id>
  </tMbSec>
<tArg xmlns="">
  <credsCachePattern>Add</credsCachePattern>
<credsCacheMeta>
<its>
<it>
  <realm>$SYSTEM</realm>
  <admin>true</admin>
<creds>
<user>
  <id>User</id>
  </user>
  <pass>Password</pass>
  </creds>
  </it>
  </its>
  </credsCacheMeta>
  </tArg>
  </GetSessions>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<GetSessionsResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>DMBIHLCAPCGEGOAECEFNBPIJOCIPPDIELLELNHENINPKCHIO!M</id>
  </id>
<sessions xmlns="">
<its>
<it>
  <id>53</id>
  <userName>ADMIN</userName>
  <userOsName>www-data</userOsName>
  <hostName>fap-bi-deployment-85c66d866f-bg766</hostName>
  <netAddress> - - - - - </netAddress>
  </it>
<it>
  <id>59</id>
  <userName>ADMIN</userName>
  <userOsName>ivan.ivanov</userOsName>
  <hostName>IVANOV</hostName>
  <netAddress>94-de-80-69-59-dd</netAddress>
  </it>
  </its>
  </sessions>
  </GetSessionsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"GetSessions" :
{
"tMbSec" :
{
"id" : "DMBIHLCAPCGEGOAECEFNBPIJOCIPPDIELLELNHENINPKCHIO!M"
},
"tArg" :
{
"credsCachePattern" : "Add",
"credsCacheMeta" :
{
"its" :
{
"it" :
[
{
"realm" : "$SYSTEM",
"admin" : "true",
"creds" :
{
"user" :
{
"id" : "User"
},
"pass" : "Password"
}
}
]
}
}
}
}
}

JSON response:

{
"GetSessionsResult" :
{
"id" :
{
"id" : "DMBIHLCAPCGEGOAECEFNBPIJOCIPPDIELLELNHENINPKCHIO!M"
},
"sessions" :
{
"its" :
{
"it" :
[
{
"id" : "53",
"userName" : "ADMIN",
"userOsName" : "www-data",
"hostName" : "fap-bi-deployment-85c66d866f-bg766",
"netAddress" : " - - - - - "
},
{
"id" : "59",
"userName" : "ADMIN",
"userOsName" : "ivan.ivanov",
"hostName" : "IVANOV",
"netAddress" : "94-de-80-69-59-dd"
}
]
}
}
}
}
public static GetSessionsResult GetSessions(string moniker, string userName, string password)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tGet = new GetSessions()
{
tArg = new GetSessionsArg()
{
credsCachePattern = ListOperation.Add,
credsCacheMeta = new UserCredsCache
{
its = new RealmUserCreds[]
{
new RealmUserCreds()
{
admin = true,
realm = "$SYSTEM",
creds = new UserCreds()
{
user = new UserId() { id = userName },
pass = password
}
}
}
}
},
tMbSec = new MbId() { id = moniker }
};
// Get list of active sessions
var result = somClient.GetSessions(tGet);
return result;
}

See also:

Working with a Repository