Querying User Sessions
Function
Queries user sessions.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
workspace:session:listSessions
List
-
-
-
-
URI
GET /v1/{project_id}/session/list-sessions
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| limit | No | Integer | The number of records for each query ranges from 1 to 100. The default value is 10. |
| offset | No | Integer | Query offset. The default value is 0. |
| user_name | No | String | Username. |
| query_begin_time | Yes | String | Search start time. The search is performed based on the session start time. A time example is 2024-02-27T03:47:51.182Z. |
| query_end_time | Yes | String | Search end time. The search is performed based on the session end time. A time example is 2024-02-27T03:47:51.182Z. |
| app_server_group_id | No | String | Application streaming server group ID. |
| vm_ip | No | String | Server IP address. |
| public_ip | No | String | Egress IP address of the client. |
| machine_name | No | String | Application streaming server name. |
| session_state | No | String | Application status. You can query statuses of multiple applications and separate statuses by commas (,). Active: The session is active. The user has logged in to and is using the session. Disconnected: The user has logged in, but the session is disconnected. AppcInit: The session is being initialized. SignedOut: The session has been logged out of. InitFail: The session fails to be initialized. |
| is_success | No | String | Whether the session has been created. If this parameter is left blank, all sessions are queried. true: successfully created false: creation failed |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | No | String | User token It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| count | Integer | Total. |
| items | Array of SessionInfo objects | Enterprise session list. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Primary key ID. |
| session_stamp | String | Session ID. |
| os_session_id | String | Session ID in the HDA OS. |
| protocol_type | String | Protocol type. |
| login_user | String | Login user of the current session. |
| session_type | String | Session type. The value 1 indicates shared desktop, and the value 2 indicates application. |
| app_server_group_id | String | Application streaming server group ID. |
| app_server_group_name | String | Application streaming server group name. |
| pre_conn_time | String | Pre-connection time. |
| start_time | String | Start time of a session. |
| end_time | String | End time of a session. |
| status_continue_time | String | Status duration. |
| machine_sid | String | Server SID. |
| machine_name | String | Server name. |
| session_state | String | Session status. |
| app_name | String | Application name in a session. |
| client_mac | String | Client MAC address. |
| client_name | String | Client name. |
| client_ip | String | Client IP address. |
| public_ip | String | Egress IP address of the client. |
| client_version | String | Client version. |
| client_type | String | Client type. |
| agent_version | String | Agent version. |
| vm_ip | String | Server IP address. |
| failed_reason | String | Error cause message. |
| failed_code | String | Error cause code. |
| last_update_status_time | String | Last status change time. |
| tenant_id | String | Tenant ID. |
| primary_server_group_id | String | Primary server group ID. |
| secondary_server_group_id | String | Standby server group ID. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 405
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 415
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code, which is returned upon failure. |
| error_msg | String | Error message. |
Example Requests
GET /v1/a4da8115c9d8464ead3a38309130523f/session/list-sessions?limit=10&offset=0&query_end_time=2024-02-28T17:47:51.182Z&query_begin_time=2024-02-26T03:47:51.182Z
Example Responses
Status code: 200
Response to a successful request.
{
"count" : 20,
"items" : [ {
"id" : "0a0666f634a54131826bf688058d0bc6",
"session_stamp" : "S-1-5-21-1908276142-124560728-768171367-3204-XXXXX@wksapp.huawei.com-HDP-2",
"protocol_type" : "HDP",
"login_user" : "XXX@wksapp.huawei.com",
"session_type" : "2",
"app_server_group_id" : "e75fef51-bbb7-489c-b4bd-63e0587faa41",
"app_server_group_name" : "TEST - Do not modify",
"pre_conn_time" : "2024-03-13T03:12:47Z",
"start_time" : "2024-03-13T03:12:47Z",
"machine_sid" : "S-1-5-21-1908276142-124560728-768171367-3204",
"machine_name" : "APS-CUY5MR45XX",
"session_state" : "AppcInit",
"agent_version" : "23.5.0.0606",
"vm_ip" : "172.*.*.218",
"failed_reason" : "",
"failed_code" : "",
"tenant_id" : "26a0420e9e284569a23f1b2f7d9b5011"
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Response to a successful request. |
| 400 | The request cannot be understood by the server due to malformed syntax. |
| 401 | Authentication failed. |
| 403 | Permissions required. |
| 404 | No resources found. |
| 405 | The request method is not allowed. |
| 415 | The requested resource format is not supported. |
| 500 | An internal service error occurred. For details, see the error code description. |
| 503 | Service unavailable. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot