Updated on 2025-09-04 GMT+08:00

Obtaining Instance Sessions

Function

This API is used to obtain instance sessions.

Constraints

This API can be used only for the following instance type:

  • GeminiDB Redis

URI

GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/sessions

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Explanation:

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

Constraints:

N/A

Values:

N/A

Default value:

N/A

instance_id

Yes

String

Explanation:

Instance ID

Constraints:

N/A

Values:

N/A

Default value:

N/A

Table 2 Query parameters

Parameter

Mandatory

Type

Description

node_id

No

String

Explanation:

Node ID

Constraints:

N/A

Values:

N/A

Default value:

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Explanation:

User token

To obtain this value, call the IAM API for obtaining a user token.

Constraints:

N/A

Values:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

node_sessions

Array of objects in Table 5

Explanation:

Node sessions

Values:

N/A

Table 5 ListNodeSessionsResult

Parameter

Type

Description

node_id

String

Explanation:

Node ID

Values:

N/A

total_count

Integer

Explanation:

Total number of sessions

Values:

N/A

sessions

Array of objects in Table 6

Explanation:

Node session details

Values:

N/A

Table 6 sessions

Parameter

Type

Description

id

String

Explanation:

Session ID

Values:

N/A

name

String

Explanation:

Connection name

Values:

N/A

cmd

String

Explanation:

Last executed command

Values:

N/A

age

String

Explanation:

Connection duration (seconds)

Values:

N/A

idle

String

Explanation:

Idle duration (seconds)

Values:

N/A

db

String

Explanation:

ID of a database that is being used by a client

Values:

N/A

addr

String

Explanation:

IP address and port of a client

Values:

N/A

fd

String

Explanation:

File descriptor for sockets

Values:

N/A

sub

String

Explanation:

Number of subscribed channels

Values:

N/A

psub

String

Explanation:

Number of subscribed modes

Values:

N/A

multi

String

Explanation:

Number of commands executed in a transaction

Values:

N/A

Example Request

  • Querying sessions of all nodes on an instance
    GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/e73893ef73754465a8bd2e0857bbf13ein12/sessions
  • Querying sessions of a specified node on an instance
    GET https://{endpoint}/v3/054e292c9880d4992f02c0196d3ea468/instances/e73893ef73754465a8bd2e0857bbf13ein12/sessions?node_id=9d3288bbbb81448e8a99ff41a5717281no12

Example Response

Status code: 200

Successful request

{ 
  "node_sessions" : [ { 
    "node_id" : "8436a91546294036b75931e879882200in06", 
    "total_count" : 1, 
    "sessions" : [ { 
      "addr" : "127.0.0.1:8080", 
      "id" : 54487, 
      "name" : "cli", 
      "cmd" : "get", 
      "age" : 8888581, 
      "idle" : 8888581, 
      "db" : 0, 
      "fd" : 1311, 
      "sub" : 0, 
      "psub" : 0, 
      "multi" : -1 
    } ] 
  }, { 
    "node_id" : "8123sa46294daw13def423fw79882200in06", 
    "total_count" : 1, 
    "sessions" : [ { 
      "addr" : "127.0.0.1:8080", 
      "id" : 54488, 
      "name" : "cli", 
      "cmd" : "get", 
      "age" : 3124124, 
      "idle" : 4414141, 
      "db" : 0, 
      "fd" : 1312, 
      "sub" : 0, 
      "psub" : 0, 
      "multi" : -1 
    } ] 
  } ] 
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.