Updated on 2026-05-21 GMT+08:00

Querying Current Session by Username

Function

Queries current session by username.

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:listSessionByUserName

    List

    -

    -

    -

    -

URI

GET /v1/{project_id}/session/user-session-info

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

user_name

Yes

String

Username.

Request Parameters

Table 3 Request header 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

Table 4 Response body parameters

Parameter

Type

Description

session_info_list

Array of AppSession objects

Sessions.

Table 5 AppSession

Parameter

Type

Description

id

String

Primary key ID.

session_stamp

String

Session ID.

os_session_id

String

ID of a session in the OS of the HDA.

protocol_type

String

Protocol type.

  • HDP

login_user

String

Login user of the current session.

session_type

String

Session type. The value 1 indicates desktop sharing, and the value 2 indicates application.

app_group_id

String

Application group ID.

app_server_group_id

String

AppServer group ID.

pre_conn_time

String

Pre-connection time.

start_time

String

Start time of a session.

end_time

String

Session end time.

status_continue_time

String

Status duration.

machine_sid

String

Server SID.

machine_name

String

Server name.

session_state

String

Session status.

  • Active: The session is active.

  • Disconnected: The session is disconnected.

  • AppcInit: The session is being initialized.

  • SignedOut: The session is logged out.

  • InitFail: The session fails to be initialized.

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.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 403

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 404

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 405

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 415

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Status code: 503

Table 13 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

Example Requests

GET /v1/a4da8115c9d8464ead3a38309130523f/session/user-session-info?user_name=user001

Example Responses

Status code: 200

Response to a successful request.

{
  "session_info_list" : [ {
    "id" : "a7db732e1ad511edaf56fa163ed8e03f",
    "session_stamp" : "S-1-5-21-1908276142-124560728-768171367-1358-zeng**long@wksapp.****huawei.com-HDP-_1",
    "protocol_type" : "Hdp",
    "login_user" : "zeng**long@wksapp.****huawei.com",
    "session_type" : "1",
    "pre_conn_time" : "2022-08-13 07:00:20",
    "start_time" : "2022-08-13 07:00:20",
    "end_time" : "0001-01-01 00:00:00",
    "machine_sid" : "S-1-5-21-1908276142-**4560728-768171367-1358",
    "session_state" : "AppcInit",
    "client_mac" : "3c-7c-3f-**-e4-04",
    "client_name" : "proven",
    "client_ip" : "10.**.**.239",
    "client_version" : "22.4.2.12888",
    "client_type" : "Windows 10 Enterprise",
    "agent_version" : "21.12.0.11461",
    "vm_ip" : "172.**.**.26",
    "failed_reason" : "success",
    "failed_code" : "WKS.00000000",
    "tenant_id" : "26a0420e9e284569a23f1b2f7d9b5011"
  }, {
    "id" : "9d123d5e0f36419c9b345efcd031a92e",
    "session_stamp" : "S-1-5-21-1908276142-124560728-768171367-3006-zeng**long@wksapp.****huawei.com-HDP-2",
    "os_session_id" : "2",
    "protocol_type" : "Hdp",
    "login_user" : "zeng**long@wksapp.****huawei.com",
    "session_type" : "2",
    "app_group_id" : "587004825166675968",
    "app_server_group_id" : "fb8a92be-ebc1-4dac-9a4c-1590518d140a",
    "pre_conn_time" : "2023-07-07 03:04:06",
    "start_time" : "2023-07-07 03:04:06",
    "end_time" : "0001-01-01 00:00:00",
    "machine_sid" : "S-1-5-21-1908276142-***560728-768171367-3006",
    "machine_name" : "APS-6NGU98Y4W4",
    "session_state" : "AppcInit",
    "app_name" : "HDTransmission,winlogon,HDTerminalExplorer,slui,HDTerminalAssist,fontdrvhost,TSTheme,ChsIME,ctfmon,csrss,HDTerminalSystem,dwm,ChsIME,sihost,HDTerminalDisplay,TabTip32,svchost,svchost,HDTerminalUser,taskhostw,TabTip",
    "client_mac" : "3c-7c-3f-**-e4-04",
    "client_name" : "proven",
    "client_ip" : "10.*.97.212",
    "client_version" : "23.2.2.0",
    "client_type" : "Windows 10 Enterprise",
    "agent_version" : "23.2.0.0314",
    "vm_ip" : "172.*.*.41",
    "failed_reason" : "success",
    "failed_code" : "WKS.00000000",
    "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.