getUserSessionInfo
A MoogDb v2 method that returns session information for a single user over a period of time.
Back to MoogDb V2 API Method Reference.
Request arguments
Method getUserSessionInfo
takes the following request arguments:
Name | Type | Required | Description |
---|---|---|---|
| String | Yes | Name of the user. |
| Number | No | Start time of the period you want to retrieve session information for. This is in Unix epoch time in seconds. If empty, returns all session information for the user. |
| Number | No | End time of the period you want to retrieve session information for. This is in Unix epoch time in seconds. If empty, returns user records to date. |
| Number | No | Starting record from which data should be included. Default is 0, the first record. |
| Number | No | Maximum number of records you want to return. Default is 200. |
Response
Method getUserSessionInfo
returns the following response:
Type | Description |
---|---|
Number | ID of the session. |
Number | Start time of the session, in Unix epoch time. |
Number | Last access time within the session, in Unix epoch time. |
Examples
The following examples demonstrate typical use of method getUserSessionInfo
:
Request example
Example request to return ten records of session information for username "graze", starting from the second session:
var UserMap = {"username":"graze", "from":1570544146, "to":1570700529, "start":2, "limit":10}; var SessionInfo = moogdb.getUserSessionInfo(UserMap); logger.warning("getUserSessionInfo with username, start, limit, from and to ..."+ JSON.stringify(SessionInfo));
Response example
Example response returning session information for username "graze":
getUserSessionInfo with username, start, limit, from and to ... [ {"sessionId":2,"startTime":1570700522,"lastAccess":1570700522}, {"sessionId":3,"startTime":1570700529,"lastAccess":1570700529}, {"sessionId":7,"startTime":1570700675,"lastAccess":1570700675}, {"sessionId":9,"startTime":1570703911,"lastAccess":1570703911}, {"sessionId":13,"startTime":1570704735,"lastAccess":1570704735} ]