The "listSessions" action returns a list of active sessions that the logged-in account is authorized to see. The list can be filtered to include sessions from specific usernames.
Request examples
Minimal
{
"action": "listSessions",
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"requestId": "2",
"api": "admin",
"action": "listSessions",
"params": {
"usernameFilter": [
"jim"
]
},
"responseOptions": {
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "string"
},
"apiVersion": "1.0",
"debug": "max",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response examples
Success
{
"result": {
"sessions": [
{
"username": "ADMIN",
"description": "optional user description of session for troubleshooting",
"authToken": "replaceWithAuthTokenFromCreateSession"
}
]
},
"requestId": "00000045",
"errorCode": 0,
"errorMessage": "",
"authToken": "replaceWithAuthTokenFromCreateSession"
}Failure
{
"authToken": "invalidAuthtoken",
"requestId": "2",
"debugInfo": {
"request": {
"authToken": "invalidAuthtoken",
"api": "admin",
"action": "listSessions",
"requestId": "2"
}
},
"errorCode": 12031,
"errorMessage": "'authToken' does not match any existing session. Use a valid 'authToken' or use 'createSession' to create a valid 'authToken'."
}
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
usernameFilter |
The |
Optional with default of []
|
array | 1 to 64 bytes |
Response properties ("result")
| Property | Description | Type | Limits (inclusive) |
|---|---|---|---|
sessions |
The |
array of objects |
|
|
sessions .username |
The All API actions are performed in the context of the account identified by In JSON DB API and JSON Hub API, use the Unlike other property names, such as A zero-length username is invalid.
In Key-Value actions, the
|
string
|
1 to 64 bytes |
|
sessions .description |
The Markdown is a good language for formatting description text. You must ensure the text is compatible with a JSON string. For example, you must escape a double quote character using the backslash character:
In the Thing API, It defaults to
|
string | 1 to 65,500 bytes |
|
sessions .authtoken |
The It is supplied by the server in response to the connect action. Clients must include it in all subsequent requests to validate that they are authenticated and authorized. If the client does not supply the correct values, the server returns an unauthorized error. |
string | 0 to 255 bytes |